Está en la página 1de 13

Carlos E.

Canto Quintal
Receptor
Sistema de comunicacin serial
Registro de corrimiento
entrada paralelo/salida serie
Buffer de dato transmitido
Buffer de dato recibido
Reloj del
Transmisor
Transmisor
8 bits
Dato de la fuente
8 bits
Dato al destino
8 bits
8 bits
Registro de corrimiento
entrada serie/salida paralelo
Reloj del
Receptor
1 bit a la vez
MICROPROCESADORES
El UART
Circuitos integrados adaptadores de
comunicacin serial ms usados
Circuitos integrados adaptadores de
Circuitos integrados adaptadores de
comunicaci
comunicaci

n serial m
n serial m

s usados
s usados
UART
UART (Universal Asynchronous Reciever
Transmitter).
ACIA
ACIA ( Asynchronous Communications
Interfase Adapter).
Z80 SIO
Z80 SIO (Serial Input/Output)
USART
USART ( (Universal Synchronous Asynchronous
Reciever Transmitter)
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
FUNCIONES DE UN UART
FUNCIONES DE UN UART
CONVIERTE LOS DATOS DE PARALELO A SERIE Y VICEVERSA
GENERA Y CHECA LA PARIDAD DE LOS DATOS
GENERA BIT DE ARRANQUE
INSERTA BIT DE PARADA
CONTROLA EL NMERO DE BITS POR CARCTER
ALMACENA TEMPORALMENTE EL MENSAJE
CONTROLA LA VELOCIDAD DE TRANSMISIN-RECEPCIN
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
PUERTO SERIE RS232C
UART
CPU Manejador
RS-232
Paralelo/serie
Serie/paralelo
NIVEL TTL NIVEL RS232
DIAGRAMA DE BLOQUES DE UN PUERTO SERIE RS232C
USANDO UN UART
Perifrico serie
de
entrada
Perifrico serie
de
salida
Bus de datos
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Protocolo de comunicacin asncrona de
bit de arranque/bit de parada
bit de arranque/bit de parada
b0 b1 b2 b3 b4 b5 b6 b7
de 7 8 bits de datos
Bit de arranque
Lnea ociosa
Bit(s) de parada
P
Bit de paridad
opcional
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Carlos E. Canto Quintal
Registro control de lnea
Latchdivisor (LS)
Latchdivisor (MS)
Registro de Status de lnea
Retn de transmisor
control de modem
Status de modem
Buffer del
bus de datos
habilitador de interrupciones
identificador de interrupciones
Lgica de
control de
interrupciones
Lgica de
control del
modem
Registro de corrimiento
del transmisor
Temporizacin
y control del
receptor
Registro de corrimiento
del receptor
Generador
de baudaje
Temporizacin
y control del
transmisor
Buffer del receptor
Intr
Sout
Baudout
Sin
Rclk
D0-D7
Arquitectura interna del UART Arquitectura interna del UART
8250 8250
RTS
CTS
DTR
DSR
DCD
RI
OUT1
OUT2
MICROPROCESADORES
El UART
Manual
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Orden de las se Orden de las se ales de ales de handshaking handshaking o de control en una comunicaci o de control en una comunicaci n n Half Half
duplex duplexv v a puerto RS232. a puerto RS232.
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Registro de Control de Lnea (Line Control Register
LCR)
DLAB
DLAB
Break
Control
0=off
1=on
Break
Control
0=off
1=on
Nmero
de stops
bits
0=1
1=2
Nmero
de stops
bits
0=1
1=2
Paridad
000 = ninguna
001 = impar
011 = par
101 = marca
111 = espacio
Nmero de bits
de Datos
10=7
11=8
b0 b1 b2 b3 b4 b5 b6 b7
Divisor Latches Access Bit:
Bit de Acceso a los Latches
Divisores
Divisor Latches Access Bit:
Bit de Acceso a los Latches
Divisores
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Registro de Status de Lnea (Line Status Register
LSR)
Siempre
0
Siempre
0
Tranmisor
vaco
(TXE)
Tranmisor
vaco
(TXE)
Buffer
de
Transmisor
Vaco
(TBE)
Buffer
de
Transmisor
Vaco
(TBE)
Deteccin
de
Break
Deteccin
de
Break
Error
de
tramado
Error
de
tramado
Error
de
paridad
Error
de
paridad
Error
de
Overrun
Error
de
Overrun
Dato
Listo
(RxRDY)
Dato
Listo
(RxRDY)
b0 b1 b2 b3 b4 b5 b6 b7
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Registro de Habilitacin de Interrupciones
(Interrupts Enable Register IER)
Siempre
0
Siempre
0
Siempre
0
Siempre
0
Siempre
0
Siempre
0
Siempre
0
Siempre
0
Entrada
RS232
Entrada
RS232
Error
del
Receptor
o
break
Error
del
Receptor
o
break
Buffer
del
Transmisor
Vaco
(TBE)
Buffer
del
Transmisor
Vaco
(TBE)
Dato
Recibido
(RxRDY)
Dato
Recibido
(RxRDY)
b0 b1 b2 b3 b4 b5 b6 b7
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Registro de Identificacin de Interrupciones
(Interrupts Identificacin Register IIR)
Siempre
0
Siempre
0
Siempre
0
Siempre
0
Siempre
0
Siempre
0
Siempre
0
Siempre
0
Siempre
0
Siempre
0
b0 b1 b2 b3 b4 b5 b6 b7
Entrada RS232 3 0 0 0
Buffer del Transmisor vaco 2 0 1 0
Dato Recibido 1 0 0 1
Error de serializacin o Break 0 0 1 1
Ninguna Ninguna 1 0 0
Interrupcin identificada Prioridad * Bit 0 Bit 1 Bit 2
* 0 Es la ms alta
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Latch Divisor Ms Significativo R/W 1 0 0 1 1
Latch Divisor Menos Significativo R/W 0 0 0 1 1
Scratch Pad R/W 1 1 1 X X
Registro de Status del Modem R/W 0 1 1 X X
Registro de Status de Lnea R/W 1 0 1 X X
Registro de Control del Modem R/W 0 0 1 X X
de Control de Lnea R/W 1 1 0 X X
Identificacin de Interrupcin LECTURA 0 1 0 X X
Habilitacin de interrupciones R/W 1 0 0 0 0
Receptor(lectura) Transmisor
(escritura)
__ 0 0 0 0 0
Registro
Lectura /
Escritura
A0 A1 A2 DLAB
Tabla de Registros y el DLAB
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Configuracin de pines del UART National 8250
D7-D0
INTRPT
MR
A1
A0
A2
DISTR
DOSTR
Manejadores
EIA RS-232
A conector
RS-232
SOUT
SIN
RTS
DTR
DSR
DCD
CTS
RI
XTAL1
XTAL2
BAUDOUT
RCLK
ADS
DOSTR
DISTR
CS2
CS1
CS0
0
1
3.072 MHZ
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
CONFIGURACIONES DE PINES DEL NS16650
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
DISTRIBUCIN DE TERMINALES DEL UART16650
TERMINALES DEL UART16650
ADS, Address Strobe, Pin 25: The positive edge of an active Address Strobe (ADS)
signal latches the Register Select (A0, A1, A2) and Chip Select (CS0, CS1, CS2) signals.
Note: An active ADS input is required when the Register Select (A0, A1, A2) and Chip
Select (CS0, CS1, CS2) signals are not stable for the duration of a read or write
operation. If not required, tie the ADS input permanently low.
BAUDOUT, Baud Out, Pin 15: This is the 16 X clock signal from the transmitter
section of the UART. The clock rate is equal to the main reference oscillator frequency
divided by the specified divisor in the Baud Generator Divisor Latches.The BAUDOUT may
also be used for the receiver section by tying this output to the RCLK input of the chip.
CS0, CS1, CS2, Chip Select, Pins 1214: When CS0 and CS1 are high and CS2 is
low, the chip is selected. This enables communication between the UART and the CPU.
The positive edge of an active Address Strobe signal latches the decoded chip select
signals, completing chip selection. If ADS is always low, valid chip selects should stabilize
according to the tCSW parameter.
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
DDIS, Driver Disable, Pin 23: This goes low whenever the CPU is
reading data from the UART. It can disable or control the direction of a
data bus transceiver between the CPU and the UART.
MR, Master Reset, Pin 35: When this input is high, it clears all the
registers (except the Receiver Buffer, Transmitter Holding, and Divisor
Latches), and the control logic of the UART. The states of various output
signals (SOUT, INTR, OUT 1, OUT 2, RTS, DTR) are affected by an active
MR input (Refer to Table I.) This input is buffered with a TTLcompatible
Schmitt Trigger with 0.5V typical hysteresis.
RCLK, Receiver Clock, Pin 9: This input is the 16 c baud rate clock
for the receiver section of the chip.
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
TERMINALES DEL UART16650
FIFO CONTROL REGISTER
This is a write only register at the same location as the IIR
(the IIR is a read only register). This register is used to enable
the FIFOs, clear the FIFOs, set the RCVR FIFO trigger level,
and select the type of DMA signalling.
Bit 0: Writing a 1 to FCR0 enables both the XMIT and RCVR
FIFOs. Resetting FCR0 will clear all bytes in both FIFOs.
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
CONEXIN DEL UART USANDO
INTERRUPCIONES
Bus de Direcciones
Bus de Direcciones
CPU
CPU
UART
UART
MODEM
MODEM
Bus de Datos
Bus de Datos
LNEA
TELEFNICA
LNEA
TELEFNICA INTR
LNEAS DE CONTROL
Y DE STATUS (HANSDSHAKING)
Driver
RS232
Driver
RS232
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
+5v
+5v
fxtal=1.8432
3.072 Mhz
RESET
MANEJADORES
RS232
(MAX232)
INT
IORD
IOWR
BUS DE DATOS
BUS DE DIRECCIONES
A0
A1
A2
A3
A4
A2
A5
A6
A7
D0-D7
AL
8255
AL
ADC0804
AL
8254
SIN USO
A0 A1 A7 A2 A3 A4 A5 A6
X X X 0 0 0 1 1
AL
UART
DIRECCIONES DE SELECCIN DEL UART 90H AL
97H
XIN
XOUT
REOJ
EXTERNO
SALIDA
OPCIONAL
DEL RELOJ
USANDO UN OSCILADOR EXTERNO,
QUE PODRIA SER EL OSCILADOR
USADO PARA E LCPU
16
17
PRACTICA NUM. 10
IMPLEMENTACIN DE UN PUERTO SERIE USANDO EL UART
NS8250
Carlos
Canto
Indicador de que el UART se ha
seleccionado
90H-97H
74LS138
A
1
B
2
C
3
G1
6
G2A
4
G2B
5
Y0
15
Y1
14
Y2
13
Y3
12
Y4
11
Y5
10
Y6
9
Y7
7
74LS08
1
2
3
40-60pf 10-30pf
1.5k
1M
7414
1 2
1 2
7414
3 4
7414
1 2
220
8250
CS0
12
CS1
13
C
S
2
1
4
RD
21
WR
18
RD
22
WR
19
A0
28
A1
27
A2
26
D0
1
D1
2
D2
3
D3
4
D4
5
D5
6
D6
7
D7
8
ADS
25
RESET
35
XTAL1/CLK
16
XTAL2
17
RCLK
9
OUT1
34
OUT2
31
INT
30
TXD
11
RTS
32
DTR
33
RXD
10
DCD
38
DSR
37
CTS
36
RI
39
CSOUT
24
DDIS
23
NC
29
BAUDOUT
15
VCC
40
GND
20
SALIDA SERIE RS232
ENTRADA SERIE RS232
SALIDA SERIE TTL
ENTRADA SERIE TTL
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
Programa para transmitir datos por el puerto Serial con un UART sin
usar interrupciones
Inicio
Inicio
Definir formato
del dato
Definir formato
del dato
Seleccin velocidad
de transmisin
Seleccin velocidad
de transmisin
Leer dato de
memoria
Leer dato de
memoria
Termin
transmisin ?
Termin
transmisin ?
Transmitir dato
Transmitir dato
Es ltimo dato ?
Es ltimo dato ?
No
No
End
End
Si
Si
LD B, NUM_DAT
LD HL,ALMACEN-1
LD A,PAL_CTRL
OUT (LCR),A
LD A, N_LSB
OUT (LATCH_DIVL),A
LD A,N_MSB
OUT (LATCH_DIVM),A
IN A,(LCR)
AND 7FH
OUT (LCR),A
OTRO: INC L
LD A,(HL)
OUT (BUFF_TX),A
DE_NUEVO: IN A,(LSR)
AND 60H
CP 60H
JP NZ,DE_NUEVO
DJNZ,OTRO
END
NUM_DAT EQU 10H
ALMACEN EQU 800H
PAL_CTRL EQU 87H
LCR EQU 93H
LATCH_DIVL EQU 90H
LATCH_DIVM EQU 91H
BUFF_TX EQU 90H
LSR EQU 95H
N_LSB EQU 14H
N_MSB EQU 00H
Carlos E. Canto Quintal
MICROPROCESADORES
El UART
GEN DE
BAUDAJE
Carlos E. Canto Quintal
MICROPROCESADORES
El UART

También podría gustarte