In this case, the user may have to choose another crystal frequency. Rounding off TH1 to the nearest integer may :not produce the desired baud rate. Therefore, the equation to calculate TH1 can be written as : Most of the time the user knows the baud rate and needs to know the reload value for TH1. Using Timer/Counter 1 to Generate Baud Ratesįor this purpose, Timer 1 is used in mode 2 (Auto-Reload). The baud rate can be generated by either Timer 1 or Timer 2 (8052 only). Only the SCON register needs to be defined. To run the Serial Communication Interface in Microprocessor port in this mode none of the Timer/Counters need to be set up. Mode 0 has a fixed baud rate which is 1/12 of the oscillator frequency. Generating Baud Rates Serial Port in Mode 0 : This register contains not only the mode selection bits, but also the 9th data bit for transmit and receive (TB8 and RB8), and the Serial Communication Interface in Microprocessor port interrupt bits (TI and RI). The serial port control and status regsiter is the Special Function Register SCON, shown in Fig. Reception is initiated in the other modes by the incoming start bit if REN = 1. Reception is initiated in Mode 0 by the condition RI = 0 and REN = 1. In all four modes, transmission is initiated by any instruction that uses SBUF as a destination register. In fact, Mode 3 is the same as Mode 2 in all respects except the baud rate. In this mode, 11 bits are transmitted (through TXD) or received (through RXD) : a start bit (0), 8 data bits (LSB first), a programmable 9th data bit and a stop bit (1). The baud rate is programmable to either Y 32 or 1 4 the oscillator frequency. On receive, the 9th data bit goes into RB8 in Special Function Register SCON, while the stop bit is ignored. Or, for example, the parity bit (P, in the PSW) could be moved into TB8. On Transmit, the 9th data bit (TB8 in SCON) can be assigned the value of 0 or 1. In this mode, 11 bits are transmitted (thorugh TXD) or received (through RXD) : a start bit (0), 8 data bits (LSB first), a programmable 9th data bit, and a stop bit (1). On receive, the stop bit goes into RB8 in Special Function Register SCON. In this mode, 10 bits are transmitted (through TXD) or received (through RXD) : a start bit (0), 8 data bits (LSB first), and a stop bit (1). The baud rate is fixed at 1/12 the oscillator frequency. 8 bits are transmitted/received : 8 data bits (LSB first). In this mode, Serial Communication Interface in Microprocessor data enters and exits through RXD.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |