ON 20070822@1:31:55 PM at page: http://www.piclist.com/microchip/language/c/S628.htm#39315.6753240741 James Newton[JMN-EFP-786] Published and replied to post 39315.6753240741 by davec64 |Insert 'Ah! Very common and annoying error. X is being ASSIGNED the value of RCVBUFSIZE rather then being compaired to it. It should be "if (x==RCVBUFSIZE)" and the best coding style to avoid makeing this mistake is to always put the constant first. E.g. "if (RCVBUFSIZE==X)" becuase if you only put in one "=" the compiler will show you the error.' at: '' davec64@gmail.com
BUg on line|Delete 'P-' before: '' but after: 'pic@danlhenry.com
if (x = RCVBUFSIZE) // beyond buffer boundary
x = 0; // wrap to begin
note the missing = in the if statement drove me mad for we while!
Regarding the notes on this page:|Delete 'P-' before: '' but after: '
http://www.piclist.com/techref/microchip/language/c/index.htm
There is absolutely no reason to resort to the following (which is wrong anyway due to its lacking the 'volatile' qualifier):
#define PIN(x,y,z) static bit x @ ((unsigned)&y*8+z)
HI-TECH already provides definitions for PIC SFRs and SFR bits. It's much more straight forward and less error prone to simply use:
#define LED1 RA0