Page 1 of 1

Having problems with an undeclared variable "ch" in Loop()

PostPosted: Tue May 07, 2013 11:35 pm
by W8DER
There is nothing more humbling for a ham than to have problems with software and cannot find the solution anywhere. I have read chapters 2 and 3 several times and still cannot figure out why I cannot compile the program. In the Loop() procedure, I keep getting an Undefined variable error in reference to the "ch" as in

else if (ch < 31 && ch != 0x1c && ch != 0x1d && ch != 0x27).

The same variable won't compile in chapter 2 as in Loop() again --

if ((inbyte > 31 || inbyte == 0x1c || inbyte == 0x1d || inbyte == 0x27) && (buflen < BUFFERSIZE))

I must be forgetting to include something, but I am at a loss to know what. Can anyone get me over this bump in the road?

Thanks,

Mike, W8DER

Mike@W8DER.Net

Re: Having problems with an undeclared variable "ch" in Loop

PostPosted: Wed May 08, 2013 5:13 pm
by wb6ajx
Mike,

This looks like an error in the the code. You need to change all refs of "ch" to "inbyte". Once done, code will compile properly.

Good Luck!,

Doug - WB6AJX

Re: Having problems with an undeclared variable "ch" in Loop

PostPosted: Thu May 09, 2013 1:13 pm
by W8DER
Thanks Doug, you are right! Apparently the programmer added FS (0x1c) GS (0x1d) and ' (0x27) at a later time as acceptable characters and just made a little error in his "cut and paste" technique. However, I am not sure about the ||inbyte==0x27 part of the corrected statement. He has already included characters > 31 decimal. Did he mean to include the ESC, which is DECIMAL 27?

I wish I knew more about APRS acceptable characters.

Maybe we should go back to the Timber section and post a correction there for readers who are stuck in chapter 2 also.

Mike@W8DER.Net

Re: Having problems with an undeclared variable "ch" in Loop

PostPosted: Thu May 09, 2013 6:07 pm
by wb6ajx
He has already included characters > 31 decimal. Did he mean to include the ESC, which is DECIMAL 27?

This is possibly another error. Since ESC is not a printable char I think that he wanted 0x27. You're right about the >31 test so you could leave the code as is or remove the 0x27 part of the statement

Maybe we should go back to the Timber section and post a correction there for readers who are stuck in chapter 2 also.

Good idea. I'll do it if you don't want to. Let me know.

Doug - WB6AJX