We make it 0 since we are not using the 8051 in a

This preview shows page 58 - 67 out of 93 pages.

We make it 0 since we are not using the 8051 in amultiprocessor environment.SM2=0 : Single processor environmentSM2=1 : multiprocessor environment
59REN (Receive Enable)SCON.4Set/cleared by software to enable/disablereception.REN=1It enable the 8051 to receive data on the RxD pin of the 8051.If we want the 8051 to both transfer and receive data, RENmust be set to 1.SETB SCON.4REN=0The receiver isdisabled.The 8051 can not receive data.CLR SCON.4
60TB8 (Transfer Bit 8)SCON.3TB8 is used for serial modes 2 and 3.The 9thbit that will be transmitted in mode 2 & 3.Set/Cleared by software.
61RB8 (Receive Bit 8)SCON.2In serial mode 1, RB8 gets a copy of the stop bitwhen an 8-bit data is received.
62TI (Transmit Interrupt Flag)SCON.1When the 8051 finishes the transfer of the 8-bitcharacter, it raises the TI flag.TI is raised by hardware at the beginning of thestop bit in mode 1.Must be cleared by software.
63RI (Receive Interrupt)SCON.0Receive interrupt flag. Set by hardware halfwaythrough the stop bit time in mode 1. Must becleared by software.When the 8051 receives data serially via RxD, itgets rid of the start and stop bits and place the bytein the SBUF register.Then 8051 rises RI to indicate that a byte.RI is raised at the beginning of the stop bit.
64Figure 10-9. SCON Serial Port ControlRegister (Bit Addressable)SM0SCON.7Serial port mode specifierSM1SCON.6Serial port mode specifierSM2SCON.5Used for multiprocessor communication. (Make it 0)RENSCON.4Set/cleared by software to enable/disable reception.TB8SCON.3Not widely used.RB8SCON.2Not widely used.TISCON.1Transmit interrupt flag. Set by hardware at the beginning ofthe stop bit in mode 1. Must be cleared by software.RISCON.0Receive interrupt flag. Set by hardware halfway through thestop bit time in mode 1. Must be cleared by software.Note: Make SM2, TB8, and RB8 = 0.SM0SM1SM2RENTB8RB8TIRI
65Transfer Data with the TI flag (1/2)The following sequence is the steps that the 8051goes through in transmitting a character via TxD:1.The byte character to be transmitted is written into theSBUF register.2.It transfers thestart bit.3.The8-bit characteris transferred one bit at a time.4.Thestop bitis transferred.SBUFTxDbit by bit8-bit charUARTTI
66Transfer Data with the TI flag (2/2)Sequence continuous:5.During the transfer of the stop bit, the 8051 raises theTI flag, indicating that the last character wastransmitted and it is ready to transfer the nextcharacter.6.By monitoring theTIflag, we know whether or not the8051 is ready to transfer another byte.We will notoverloadingthe SBUF register.If we write another byte into the SBUF before TI is raised,theuntransmitted portion of the previous byte will be lost.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 93 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
cheung
Tags
Serial communication, Serial port, baud rate, RS 232

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture