This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can't generate UART interrupt ???(EPM900)

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!

  • Hi,

    the EPM900 with UART + Interrrupts works fine. You find my example at http://www.c51.de /lpc900 / Test_RS232.zip

    Mike

  • In Mode-3 aka "9-bit mode", setting SM2 enables Automatic Address Recognition.

    Automatic Address Recognition is described in the 89LPC932 User Manual.

    See also Intel Application Note AP-410, Enhanced Serial Port on the 83C51FA.

    And this discussion:
    http://www.keil.com/forum/docs/thread2882.asp

  • 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.