110 likes | 448 Views
USART 8051. Prof Afonso Ferreira Miguel. Microcontrolador 8051 (MCS-51) Interface Serial. Full duplex UART. Four modes of operation: Synchronous serial I/O expansion. Asynchronous serial I/O with variable baud rate. Nine bit mode with variable baud rate. Nine bit mode with fixed baud rate.
E N D
USART 8051 Prof Afonso Ferreira Miguel
Microcontrolador 8051 (MCS-51)Interface Serial • Full duplex UART. • Four modes of operation: • Synchronous serial I/O expansion. • Asynchronous serial I/O with variable baud rate. • Nine bit mode with variable baud rate. • Nine bit mode with fixed baud rate. • 10 or 11 bit frames. • Interrupt driven or polled operation. • Registers: • SCON - Serial port control register. • SBUF - Read received data. • - Write data to be transmitted. • PCON - SMOD bit.
Microcontrolador 8051 (MCS-51)Interface Serial: Modos • TXD and RXD are the serial output and input pins (Port 3, bits 1 and 0). • Mode 0: Shift Register Mode. Serial data is transmitted/received on RXD. TXD outputs shift clock. Baud Rate is 1/12 of clock frequency; • Mode 1: 10-bits transmitted or received. Start (0), 8 data bits (LSB first), and a stop bit (1). Baud Rate Clock is variable using Timer 1 overflow or external count input. Can go up to 104.2KHz (20MHz osc.); • Mode 2: 11-bits transmitted or received. Start (0), 8 data bits (LSB first), programmable 9th bit, and stop bit (1). Baud Rate programmable to either 1/32 or 1/64 oscillator frequency (625KHz for 20MHz osc.); • Mode 3: 11-bit mode. 9 data bits; Baud Rate variable using Timer 1 overflow or external input. 104.2 KHz max. (20 MHz osc.).
Microcontrolador 8051 (MCS-51) • Configuração
Microcontrolador 8051 (MCS-51) • Rotinas típicas para TX e RX um byte
Microcontrolador 8051 (MCS-51) • Rotina típica para transmitir uma string
Microcontrolador 8051 (MCS-51) • Utilizando a rotina anterior: • Definindo a string em memória