Đang chuẩn bị liên kết để tải về tài liệu:
Các vi điều khiển 8051
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Đây là tài liệu thiết bị điện - điện tử, vi điều khiển 8051- bộ thu phát nối tiếp 8501 gửi đến các bạn độc giả tham khảo. | ĐH Bách Khoa TP.HCM Lê Chí Thông www.tinyurl.com thongchile The 8051 Microcontroller Chapter 5 Serial Port Operation Lê Chí Thông Ref. I. Scott Mackenzie The 8051 Microcontroller Serial Port RXD P3.0 and TXD P3.1 pins Full Duplex simultaneous transmission and reception 2 special function registers SCON and SBUF SCON status bits and control bits SBUF same address but 2 buffers 1 buffer for transmission and 1 buffer for reception Baud rate serial port frequency of operation is supplied and programmed by Timer1 Ref. I. Scott Mackenzie Lê Chí Thông 2 1 Lê Chí Thông www.tinyurl.com thongchile ĐH Bách Khoa TP.HCM Writing to SBUF loads data to be transmitted Reading SBUF accesses received data Ref. I. Scott Mackenzie Lê Chí Thông SCON Register 7 SMO 6 5 SMI SM2 4 3 2 1 0 REN TB8 RB8 TI Rl BIT SYMBOL ADDRESS DESCRIPTION SCON.7 SMO 9FH Serial port mode bit 0 see Table 5-2 SC0N.6 SM1 9EH Serial port mode bit 1 see Table 5-2 SCON.5 SM2 9DH Serial port mode bit 2. Enables multiprocessor communications in modes 2 3 Rl will not be activated if received 9th bit is 0 SCON.4 REN 9CH Receiver enable. Must be set to receive characters SCON.3 TB8 9BH Transmit bit 8. 9th bit transmitted in modes and 3 set cleared by software SCON.2 RB8 9AH Receive bit 8. 9th bit received SCON.1 Tl 99H Transmit interrupt flag. Set at end of character transmission cleared by software SCON.O Rl 98H Receive interrupt flag. Set at end of character reception cleared by software Ref. I. Scott Mackenzie Lê Chí Thông 4 2 ĐH Bách Khoa TP.HCM Lê Chí Thông www.tinyurl.com thongchile SCON Register 7 6 5 4 3 2 1 0 SMO SMI SM2 REN TB8 RB8 Tl Rl TABLE 5-2 Serial port modes SMO SM1 MODE DESCRIPTION BAUD RATE 0 0 0 Shift register Fixed oscillator frequency 12 0 1 1 8-bit UART Variable set by timer 1 0 2 9-bit UART Fixed oscillator frequency 4-12 or 64 1 1 3 9-bit UART Variable set by timer Ref. I. Scott Mackenzie Lê Chí Thông 5 Mode 0 8-Bit Shift Register RXD is used for both data input and output Serial data enter and