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 I/O interrupt

Hi, gentlemen,

I am a 8051 starter. One simple question: I am trying to use a interrupt driven serial I/O. Will a writing operation to SBUF set TI to high, or in the other way, to set TI will trigger to transmit the contents of SBUF?

Thanks in advance!!

Parents
  • TI will be set when the last data bit of your byte is shifted out, that is at the same time the stop bit is being signalled on the line.

    For ISR based comm. you'll need to detect an empty send buffer (the one you create in software, usually a ring) and if empty queue the data and set TI manually to start the process.

    Likewise for receive, you'll need to have a way to know if there is anything pending in your recv. ring buffer.

    Using XDATA buffers 256 bytes in size gives your 8-bit index a nice auto-wrap feature.

    Go to Intel's developer site and pick up PDF document called MCS-51 MICROCONTROLLER FAMILY USER'S MANUAL, it is "the authority" on 8051/8052 cores, IMHO.

    - Mark

Reply
  • TI will be set when the last data bit of your byte is shifted out, that is at the same time the stop bit is being signalled on the line.

    For ISR based comm. you'll need to detect an empty send buffer (the one you create in software, usually a ring) and if empty queue the data and set TI manually to start the process.

    Likewise for receive, you'll need to have a way to know if there is anything pending in your recv. ring buffer.

    Using XDATA buffers 256 bytes in size gives your 8-bit index a nice auto-wrap feature.

    Go to Intel's developer site and pick up PDF document called MCS-51 MICROCONTROLLER FAMILY USER'S MANUAL, it is "the authority" on 8051/8052 cores, IMHO.

    - Mark

Children