Hello, In trying to compile the C code with the C51 compiler [Keil µvision2], I received error c213 "left side of asn-op not an lvalue" - " the address of a changeable object is required at the right side of the assignment operator". But i don't know where is/are problems... Code: #include <Chipcon\srf04\regssrf04.h> #include <Chipcon\srf04\halsrf04.h> #include <Chipcon\srf04\ebsrf04.h> #include <ctype.h> #define TX_entree 0x80 //P0.4 #define RI0 0x98 BYTE idata txBuffer[8]; BYTE idata buffer[8]; int i = 0; int taille_tab; void main () { #ifdef STAND_ALONE CLOCK_INIT(); IO_PORT_INIT(); #endif ebLcdInit(); ebLcdUpdate("Emission test v0.1", NULL); halWait(3000); ebLcdUpdate("Initialisation", NULL); halWait(2000); halUartSetup(UART_BAUDRATE_115200, DEFAULT_MODE); SPI_INIT(SCLK_6_MHZ); POWER_UP_RESET_CCxxx0(); FIRST ERROR UART_RX_ENABLE(); ebLcdUpdate("Reception et stockage des données en cours", NULL); halWait(3000); if(RI0 == 1){ //stockage des données taille_tab = sizeof(buffer); for (i = 1; i < taille_tab; i++) { UART_WAIT_AND_RECEIVE(buffer[i]); SECOND ERROR IF I COMMENT THE FIRST } } ebLcdUpdate("Emission des données en cours", NULL); halWait(2000); SPI_ENABLE(); halRfSendPacket(buffer, sizeof(buffer)); ebLcdUpdate("Fin", NULL); halWait(2000); } Any help or comments appreciated. I'm workin' on the CC2500DK, it's an tranceiver HF and many fonctions has already created by the constructor. Thanks John
"For the purposes of debugging, you should take your macro 'calls' and replace them with the individual construct. That is, put the defined do{}while(0); in the main code and try to compile it rather than using the macros." No, don't do that! You stand far more chance of messing it up in the process - or even inadvertently fixing a bug! Anyway, it's a waste of time - the preprocessor does all this for you anyway: Just use the .i file generated by the preprocessor, and inspect that. If you can't see the problem by inspection of the .i file, then just compile the .i file! See Andy's Handy Hint for Debugging Preprocessor Problems: http://www.8052.com/forum/read.phtml?id=29152
"Just use the .i file generated by the preprocessor, and inspect that." Some compilers have the option to retain comments in the .i file - which makes the inspection a whole lot easier. Unfortunately, Keil C51 does not have this option. :-(
Unfortunately, Keil C51 does not have this option. :-( But even so, you can have this cake and eat it, too. Just use a separate preprocessor (e.g. GCC's) with the right set of options that will let it mimic Keils' #include search mechanisms and predefined macros, instead of Keil itself.