hey all; i gotto finish my semester project but i couldnt compile this program. when i try to compile target there is an error; The output window said completely is; *RF_ANA_PROGRAM.C(58): error C141: syntax error near 'void'* and the ana_program is; #include <chipcon/hal.h> #include <chipcon/reg1010.h> #include <chipcon/cc1010eb.h> void main() { //433 MHz için kalibrasyon yapıları// #ifdef FREQ433 // X-tal frequency: 14.745600 MHz // RF frequency A: 433.302000 MHz Rx // RF frequency B: 433.302000 MHz Tx // RX Mode: Low side LO // Frequency separation: 64 kHz // Data rate: 19.2 kBaud // Data Format: NRZ // RF output power: 10 dBm // IF/RSSI: RSSI Enabled RF_RXTXPAIR_SETTINGS code RF_SETTINGS = { 0xA3, 0x2F, 0x0E, // Modem 0, 1 and 2 0x58, 0x00, 0x00, // Freq A 0x41, 0xFC, 0x9C, // Freq B 0x02, 0x80, // FSEP 1 and 0 0x60, // PLL_RX 0x48, // PLL_TX 0x44, // CURRENT_RX 0x81, // CURRENT_TX 0x0A, // FREND 0xFF, // PA_POW 0xC0, // MATCH 0x00, // PRESCALER }; #endif // Initialize peripherals WDT_ENABLE(FALSE); RLED_OE(TRUE); RLED = LED_OFF; YLED_OE(TRUE); YLED = LED_OFF; GLED_OE(TRUE); GLED = LED_ON; BLED_OE(TRUE); BLED = LED_OFF; // Set optimum settings for speed and low power consumption MEM_NO_WAIT_STATES(); FLASH_SET_POWER_MODE(FLASH_STANDBY_BETWEEN_READS); // serial port 0 settings UART0_SETUP(38400, CC1010EB_CLKFREQ, UART_NO_PARITY | UART_RX_TX | UART_ISR); while(1); void isr_uart0() interrupt INUM_UART0,INUM_RF { byte received_byte; if (INT_GETFLAG(INUM_UART0_RX) == INT_SET) { received_byte = UART0_RECEIVE(); //read receive buffer INT_SETFLAG(INUM_UART0_RX, INT_CLR); // clear int halRFSetRxTxOff(RF_TX, RF_RXTXPAIR_SETTINGS code* rf_settings, RF_RXTXPAIR_CALDATA xdata* rf_caldata); if (INT_GETFLAG(INUM_RF) == INT_SET); { RF_SEND_BYTE(RF_PREAMBLE_BYTE); halRFOverrideOutputPower(RF_TX_POWER_LOW); RF_START_TX(); RF_SEND_BYTE(RF_SUITABLE_SYNC_BYTE); RF_SEND_BYTE(received_byte); GLED =~ GLED; INT_SETFLAG(INUM_RF,INT_CLR); halRFSetRxTxOff(RF_OFF); } } else if (INT_GETFLAG(INUM_RF) == INT_SET); { halRFSetRxTxOff(RF_RX, RF_RXTXPAIR_SETTINGS code* rf_settings, RF_RXTXPAIR_CALDATA xdata* rf_caldata); RF_SET_SYNC_BYTE(RF_SUITABLE_SYNC_BYTE); RF_SET_PREAMBLE_COUNT(16); RF_START_RX(); while (!RF_BYTE_RECEIVED()); INT_SETFLAG(INUM_RF,INT_CLR); RF_LOCK_AVERAGE_FILTER(TRUE); RF_RECEIVE_BYTE() = received_byte); received_byte = UART0_SEND(); BLED =~ BLED; INT_SETFLAG(INUM_UART0_TX, NT_CLR); halRFSetRxTxOff(RF_OFF); } } } can you please check this program cause I am gonna get crazy. thanks millions.(i think mr. neil can recognise the problem easily :) )
"i think mr. neil can recognise the problem easily :)" Not from that jumble you just posted, he can't! :-( Please, read the instructions about how to post code: they're right there above the white box where you type your post. Then re-post your code, following the instructions - that way the layout will be preserved, and we might stand a chance of being able to read it! See also: http://www.keil.com/forum/tips.asp
"*RF_ANA_PROGRAM.C(58): error C141: syntax error near 'void'*" It would also help if you showed which is line 58. Have you looked at it (and the preceding few lines) for any obvious syntax errors?
Oh my, what a mess. main() lacks a closing '}'. Two of your 'if' expressions are followed by a ';'. There's a start.
I said, "Have you looked at it (and the preceding few lines) for any obvious syntax errors?" Dan Henry said, "Oh my, what a mess. main() lacks a closing '}'. Two of your 'if' expressions are followed by a ';'." Yeah - that's the kind of stuff! And this is at the end of a semester...?! :-0
#include <chipcon/hal.h> #include <chipcon/reg1010.h> #include <chipcon/cc1010eb.h> void main() { //433 MHz için kalibrasyon yapıları// #ifdef FREQ433 // X-tal frequency: 14.745600 MHz // RF frequency A: 433.302000 MHz Rx // RF frequency B: 433.302000 MHz Tx // RX Mode: Low side LO // Frequency separation: 64 kHz // Data rate: 19.2 kBaud // Data Format: NRZ // RF output power: 10 dBm // IF/RSSI: RSSI Enabled RF_RXTXPAIR_SETTINGS code RF_SETTINGS = { 0xA3, 0x2F, 0x0E, // Modem 0, 1 and 2 0x58, 0x00, 0x00, // Freq A 0x41, 0xFC, 0x9C, // Freq B 0x02, 0x80, // FSEP 1 and 0 0x60, // PLL_RX 0x48, // PLL_TX 0x44, // CURRENT_RX 0x81, // CURRENT_TX 0x0A, // FREND 0xFF, // PA_POW 0xC0, // MATCH 0x00, // PRESCALER }; #endif // Initialize peripherals WDT_ENABLE(FALSE); RLED_OE(TRUE); RLED = LED_OFF; YLED_OE(TRUE); YLED = LED_OFF; GLED_OE(TRUE); GLED = LED_ON; BLED_OE(TRUE); BLED = LED_OFF; // Set optimum settings for speed and low power consumption MEM_NO_WAIT_STATES(); FLASH_SET_POWER_MODE(FLASH_STANDBY_BETWEEN_READS); // serial port 0 settings UART0_SETUP(38400, CC1010EB_CLKFREQ, UART_NO_PARITY | UART_RX_TX | UART_ISR); } while(true) ;void isr_uart0() interrupt INUM_UART0 { byte received_byte; if (INT_GETFLAG(INUM_UART0_RX) == INT_SET) { received_byte = UART0_RECEIVE(); //read receive buffer INT_SETFLAG(INUM_UART0_RX, INT_CLR); // clear int halRFSetRxTxOff(RF_TX, RF_RXTXPAIR_SETTINGS code* rf_settings, RF_RXTXPAIR_CALDATA xdata* rf_caldata); if (INT_GETFLAG(INUM_RF) == INT_SET) { RF_SEND_BYTE(RF_PREAMBLE_BYTE); halRFOverrideOutputPower(RF_TX_POWER_LOW); RF_START_TX(); RF_SEND_BYTE(RF_SUITABLE_SYNC_BYTE); RF_SEND_BYTE(received_byte); GLED =~ GLED; INT_SETFLAG(INUM_RF,INT_CLR); halRFSetRxTxOff(RF_OFF); } } else if (INT_GETFLAG(INUM_RF) == INT_SET) { halRFSetRxTxOff(RF_RX, RF_RXTXPAIR_SETTINGS code* rf_settings, RF_RXTXPAIR_CALDATA xdata* rf_caldata); RF_SET_SYNC_BYTE(RF_SUITABLE_SYNC_BYTE); RF_SET_PREAMBLE_COUNT(16); RF_START_RX(); while (!RF_BYTE_RECEIVED()); INT_SETFLAG(INUM_RF,INT_CLR); RF_LOCK_AVERAGE_FILTER(TRUE); RF_RECEIVE_BYTE() = received_byte); received_byte = UART0_SEND(); BLED =~ BLED; INT_SETFLAG(INUM_UART0_TX, NT_CLR); halRFSetRxTxOff(RF_OFF); } } }
Your indenting is still a mess! I think you still have mismatched braces - if you sort-out the indentation, this should become obvious. Also, beware of your #if ... #endif matching. Personally, I prefer to place the opening & closing braces like this:
void main( void ) { // Keep comments in line with the code // to which they relate if( condition ) { // "then" stuff } else { // "else" stuff } }
void main( void ){ if( condition ){ // "then" stuff } else{ // "else" stuff } }
"there are new errors" Yes, there certainly are! I spotted them in a matter of seconds before I even got the the error messages at the bottom of your post. You really have to try harder. I am not your remote syntax error resolver. Nobody else is either!
I am really sorry , I now you are not resolver, I didnt have time to examine all program, tomorrow I have an exam so i couldnt give my time to do it . Make sure I will do my best and then I will ask the next time . I just wanted to make you know I have looked your answers.My purpose wasnt to take your all time and solve my problems with easy way. thank you .....
"I am really sorry" Alright then, this is the last little bit from me, just to show you I'm not a bad guy :-) I'm guessing that main()'s closing '}' should go after 'while(true);'. Your halRFSetRxTxOff() parameters are all messed up. It's like you've gone into hal.h and just copied the function prototypes. You need to read the comments in "RF communications functions/macros" section in hal.h. There is a clear example of how to use the functions and required data structures. You need to be passing the data structure addresses as parameters. You really, and I mean *REALLY* need to better understand the C language, the 8051-derivative MCU architecture, the RF transceiver device, its library functions and their API. That's it -- much to learn -- too much to learn from this Forum!
look dan, i know you r good guy; first of all i didnt copy and past them if i wanna do rf communication i have to use these macros (am i wrong ?,and if i wanna use these macros ,which is better? copy and past or type all these long chars with hands (its just taking time ) ) and i have created (actually used created functions) another c file rf_rx_tx_off.c ans passed all these pointers and datas at these functions. i am not quite ignorant at this subject. i dunno but could you recognize iam student and trying to do sth thats all.if you dont wanna help there is no problem (so please dont tell me "its a little from me" if you dont wanna help just do it dont help. thanks.....
"i am not quite ignorant at this subject." So you should be capable of following simple instructions (like how to post source code), creating well-laid-out source code, and fixing basic errors like mis-matched braces? After your exam, please attend to these issues before re-posting the tidied-up code.
"i have to use these macros (am i wrong ?" Yes, you are wrong. You have to use those functions. Some of what you see in hal.h are macros, some are implicit-extern function declarations. halRFSetRxTxOff() is not a macro. Not that it matters, because they way you are invoking halRFSetRxTxOff(), whether it be a function or a macro, is all wrong in either case. "which is better? copy and past or type all these long chars with hands (its just taking time )" Well, copying function prototypes certainly isn't going to get you anywhere. Which is better, calling functions properly (as shown in the examples) or willy-nilly pasting of stuff that looks close enough (it's just creating problems that will take time to figure out and fix later)? "if you dont wanna help just do it dont help." If you don't wanna listen and understand, then I don't wanna help, so I'll take your advise, thank you.
do i still have a chance to ask question please:)
hi all; i really need to know how to send preamble byte i know the macros;but i couldnt handle with to put sth for x i mean i dont know what kind of byte the preamble byte is.can i reate or can i write hexdecimal number or ... i really dunno
RF_START_TX for (i=0; i<num_preambles-1; i++) RF_WAIT_AND_SEND_BYTE(x)
"i really need to know how to send preamble byte ... i dont know what kind of byte the preamble byte is." This is really not a Keil question - you need to direct this question to the author of the macros.