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

UART0 configuration

Hi All, I m using UV3 given along with KEIL EPM900. I was trying to simulate UART0.
Here is the peice of code is used to configure UART0.

PCON &= 0xBF;
S0STAT = 0x60;
S0CON |= 0x50;
S0CON &= 0x5F;
BRGCON_0 |= 0x02;
BRGCON_0 &= 0xFE;
BRGR1_0 = BYTE_HIGH_1;
BRGR0_0 = BYTE_LOW_1;
BRGCON_0 |= 0x01;
ESR = 1;
EST = 1;
EA = 1;
void uart0_rx_isr()interrupt 4 using 1
{ RI_0 = 0;
FLAG_BYTE_RX_0 = 1;
temp = S0BUF;
}

then read data into S0BUF in ISR function.
When i go into debug mode. I see the baud rate changing to the desiered value. But if i put some value into S0BUF, it doesnt come into the temp variable.

Plz guide me.

regards
Mithilesh

Parents
  • For a start, you didn't read the instructions on posting code, did you?
    Next time, pay attention to the Notes immediately above the message window...

    "if i put some value into S0BUF, it doesnt come into the temp variable."

    What do you mean by "some value into S0BUF"

    Do you understand that the SBUF is, in fact, not one register but two; viz, a write-only register that feeds the UART transmitter, and a read-only register fed by the UART receiver...

Reply
  • For a start, you didn't read the instructions on posting code, did you?
    Next time, pay attention to the Notes immediately above the message window...

    "if i put some value into S0BUF, it doesnt come into the temp variable."

    What do you mean by "some value into S0BUF"

    Do you understand that the SBUF is, in fact, not one register but two; viz, a write-only register that feeds the UART transmitter, and a read-only register fed by the UART receiver...

Children
No data