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

Serial Data lost

I wrote an aplication that receives data from the serial interface (80251)
When running under the uvision dscope debugger I go into the serial peripheral window and enter the data into SBUF. Then I set the interrupt. My input data is displayed in the serial window, and the interrupt triggers my ISR. The only problem is that the SBUF data never gets copied into my global variable of my program.
In C ,I have the statement rcv_data = SBUF

In assembly I get MOV A,SBUF(0x99)
MOV rcv_data(0x12F),R11
The instruction to move the SBUF (loc 0x99) to the Accumulater gets ignorred
Since memory location 0x99(SBUF) does not get pulled into the accumulater, the data never gets into my variable.
I set breakpoints all over this area and I can't understand why the instruction doesn't seem to move the data over. I can write to the accumulator with no problem in the command window (ie. A=0x49). (setting a break at this address within the interrupt.
Does anyone know what could cause this...

Parents
  • I go into the serial peripheral window and enter the data into SBUF. Then I set the interrupt.

    I guess I missed this before. This WILL NOT WORK.

    Why don't you just type your data into the serial window and let the debugger generate the interrupt automatically?

    Or, use the SIN VTREG as follows:

    SIN = 'A'
    from the Command window.

    The debugger will generate the interrupt automatically.

    Remember that when you WRITE to SBUF, you are writing a character that will be sent. When you READ from SBUF, you read a character that has been received.

    The on-chip UART sets TI when a character has been transmitter and RI when a character has been received.

    If you "trick" the processor by generating an interrupt when no character has been received, you will not receive a valid character.

    Jon

Reply
  • I go into the serial peripheral window and enter the data into SBUF. Then I set the interrupt.

    I guess I missed this before. This WILL NOT WORK.

    Why don't you just type your data into the serial window and let the debugger generate the interrupt automatically?

    Or, use the SIN VTREG as follows:

    SIN = 'A'
    from the Command window.

    The debugger will generate the interrupt automatically.

    Remember that when you WRITE to SBUF, you are writing a character that will be sent. When you READ from SBUF, you read a character that has been received.

    The on-chip UART sets TI when a character has been transmitter and RI when a character has been received.

    If you "trick" the processor by generating an interrupt when no character has been received, you will not receive a valid character.

    Jon

Children