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

Customizing the Data Logger
Leigh L. Klotz, Jr, WA5ZNU

Moderators: wa5znu, ne6rd

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

Postby W8DER » Tue May 07, 2013 11:35 pm

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
W8DER
 
Posts: 3
Joined: Thu May 02, 2013 12:45 pm

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

Postby wb6ajx » Wed May 08, 2013 5:13 pm

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
wb6ajx
 
Posts: 5
Joined: Sun Apr 28, 2013 2:56 am
Location: Southern SoCal

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

Postby W8DER » Thu May 09, 2013 1:13 pm

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
W8DER
 
Posts: 3
Joined: Thu May 02, 2013 12:45 pm

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

Postby wb6ajx » Thu May 09, 2013 6:07 pm

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
wb6ajx
 
Posts: 5
Joined: Sun Apr 28, 2013 2:56 am
Location: Southern SoCal


Return to Timber Too

Who is online

Users browsing this forum: No registered users and 1 guest

cron