We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
#include<reg51.h> void boud_rate() { SCON = 0x50; TMOD = 0x20; /* timer 1, mode 2, 8-bit reload */ TH1 = 0xFD; /* reload value for 2400 baud */ TR1 = 1; TI = 1; } char serial_receive() { char chr; /* variable to hold the new character */ while (RI != 1) {;} chr = SBUF; RI = 0; return(chr); } void main(void) { boud_rate(); unsigned char rx_data; for(;;) { rx_data = serial_receive(); switch(rx_data) { // case '1': open_door(); case 0067892341 : open_door(); break; // case '9': open_door(); case 0045780034 : open_door(); break; default: dont_open(); } proper_delay(); } }
errors
'rx_data':undefined identifier illigal octal digit
please tell me how to overcum these errors
I wonder if Keil is using PHP.
The broken display of this thread seems to be caused by a dollar sign in one of my previous posts, that seems to have trigged a replace operation that resulted in an end of the table cell and table row in the middle of the text - so the remaining part of my post is emitted inside a <table> tag but outside any <tr> or <td> tags.
Note to web designers - do care about search/replace with user-supplied data and proper handling of break characters. In this case it is broken html output. In many cases, it is database implementations that allows SQL injection hijacking or killing services.