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 don't really agree with the statement that microcontroller solutions often requires very fast instruments.
Most microcontrollers have a nice integrated clock oscillator. Either the processor runs from an internal RC oscillator, or it makes use of an external crystal and then potentially steps up the frequency internally.
But few people here have issues that the oscillator doesn't run as expected. And most microcontrollers used by beginners have all memory internally, so no fast address, data or control signals.
What then remains are JTAG interface, GPIO and peripherial-specific pins. The UART is seldom run at very high speeds. The microcontroller is often master for SPI communication, allowing the SPI speed to be reduced if needing to look at the signals. I2C don't need high speeds. ADC is an input peripherial where the majority of testing can be done at way less than the maximum bandwidth of the ADC. JTAG can be tested at a lower speed.
So even very cheap USB-connected oscilloscopes with just 1MHz bandwidth and a few Msamples/second can solve most issues people have with their microcontroller designs. It really is very seldom that there are ringing etc on signals that are the big issue, so it really is very seldom people do need really good gear to look at actual signal shapes.