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.
case: P89LPC932(ICE emulation) communicates with PC by using UART<-->RS232 environment: micro vision2 + EPM900 UART setting: UART MODE =MODE 3 SMOD0=0 (PCON.6) SCON=0xf0 (SM2=1, REN=1, TB8=0) SSTAT=0x20 (no double buffer, Rx/Tx are separate INT, Tx INT at beginning of the stop bit, disable FE'BR'OE interrupt) baudrate=9600 bps ESR=1 (enable Rx interrupt) When PC transmitted 11 bit data to EPM900 (start bit, 8 bit data, TB bit, stop bit) In "serial channel" box of "Peripheral" menu of micro vision2 I saw the SBUF get the correct data certainly, and RB8 bit became 1. But RI bit still remained 0 and did not generate interrupt. How to solve the problem? Thanks!
Thank Michael & Andy! The former problem is really due to the Automatic Address Recognition. Now when EPM900 gets correct 11 bit data, the RB8 bit and RI bit are set to 1. But the new problem is... It seemed that the instructions in ISR were not executed. The abstract of my code is listed below: void main(void) { //...other initial instructions... UART_init();//ASM code 0x005A while(1) { if(UART_Rx_OK_Flag) //ASM code 0x005D { UART_Rx_OK_Flag=0; RxDealing(); } } } ...... void UART_init(void) { SCON=0xf0; //MODE3, SM2=1, REN=1, TB8=0 SSTAT=0x20; BRGR1=0x04; BRGR0=0xd2; //9600bps BRGCON=0x03; ESR=1; //enable receive int,(EA=1 //in other initial setting //instructions) RI=0;// RT_Flag=0; // an I/O pin to control // SN75176 DE &-RE pin } ..... void UART_Rx_Interrupt(void) interrupt 4 using 2 { # (<--break point) RI=0; //ASM code 0x02A5 input_buf[index]=SBUF; if(index++==5) UART_Rx_OK_Flag=1; } The code after the break point was not executed. I set a break point in the line RI=0, then ran the problem, The "Next statement" yellow arrow pointed to assembly code number 0x005D. When EPM900 got a 11 bit data, RB8 & RI were set to 1, and the program stopped. The Next statement arrow immediately pointed to a new line(ASM code number 0x005C) which never appeared before. The assembly code is listed below.. This is the reset state C:0x005A 12054C LCALL UART_init(C:054C) C:0x005D 3003FD JNB UART_Rx_OK_Flag(0x20.3),C:005D This is the state when problem stopped from break point. The new code 0x005C appeared C:0x005A 12054C LCALL UART_init(C:054C) C:0x005C 4C ORL A,R4 C:0x005D 3003FD JNB UART_Rx_OK_Flag(0x20.3),C:005D So the instructions in ISR can't be executed. Why this situation occur ??? If I use software simualting instead of EPM900, the ISR can be execute when mamually set RI as 1.