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.
Hello, Can you please take a look at my code and tell me what may be wrong with it and what I need to change it so that it generates an interrupt when the UART0 receives data? I am sending data to my target through a terminal emulator program running on the PC, set at 9600 baud 8-N-1. Each keystroke on the keyboard sends an ASCII character to the 8051. The code should jump to the UART0 ISR, but it never does. Are there any registers that I am not initializing properly? thanks, Nick void main(void) { IOCON1=0x01; P1DIR=0xff; P1=0xff; IE=0x90; IOCON0=40; U0BR=0xD9; //set baud rate TO 9600 U0CON=0x10; //enable UART0, 8-1-N for(;;) //embedded application never stops running { } } void UART0 () interrupt 4 { unsigned int data; P1 = ~P1; //toggle the io pin data = U0BUF; //read data out of the buffer }
you are jumping out of the airplane without a parachute. First you need to know wjat you are working with. There is no better source than "the bible". The answers can be found by reading the sections about the UART in ch3. Erik here are the links to "the bible" Chapter 1 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf chapter 2 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf chapter 3 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf