8
SERIAL PORTS
The three serial ports may be individually configured for RS-232 or RS-422, and may be programmed for 8 or 9 bit protocol at standard
baud rates from 1200 to 19,200 for COM0 and 50 to 38400 for COM1 and COM2. Higher non-standard baud rates may be programmed
also.
The RS-422 option allows up to 32 serial ports to use the same twisted pair. Each end of the pair should have a terminating resistor that
matches the characteristic impedance of the line. Typically 33 ohms can be used.
The serial ports allow for multiprocessor communication using 9 bit protocol. This innovative function when enabled, will interrupt the
processor if the 9th bit of a data byte is set. Using the appropriate software allows for a powerful communication scheme.
COM0
This port is the 80535 serial interface which has 4 modes of operation. Since mode 0 is not
directly supported by the hardware, only modes 1, 2 and 3 will be described here.
MODE 1:
10 bits are transmitted or received: a start bit of 0, 8 data, and a stop bit
of 1. The baud rate is variable.
MODE 2:
11 bits are transmitted or received: a start bit of 0, 8 data, a
programmable 9th bit, and a stop bit of 1. When transmitting, the 9th bit
comes from TB8 in SCON. This could be used to hold the parity of the
data. When receiving, the 9th bit goes to RB8 in SCON, while the stop
bit is ignored. The baud rate can be either 1/32 or 1/64 of the oscillator
frequency
MODE 3:
Same as mode 2 except the baud rate is variable.
For standard baud rates in modes 1 and 3 (using a 11.059 MHZ crystal), the overflow rate
of TIMER 1 and the setting of SMOD (PCON. 7) should be used to control the baud rate.
BAUD
TIMER 1
RATE
SMOD
RELOAD VALUE
19200 1
FDH
9600
0
FDH
4800
0
FAH
2400
0
F4H
1200
0
E8H
(RS-232 CONFIGURATION)
1
2 CN1
n.c.
o o
n.c.
Tx
o o
handshake in (P5.7)
Rx
o o
handshake out (P5.6)
n.c.
o o
n.c.
GND
o o
n.c.
9
10
(RS-485 CONFIGURATION)
1
2 CN1
n.c.
o o
n.c.
TxA
o o
RxB
TxB
o o
RxA
n.c.
o o
n.c.
GND
o o
n.c.
9
10
Using the information from the above table, you can modify the subroutine SERST below to generate different baud rates:
;
; SERST - Serial port setup and start.
;
SERST:
CLR SMOD
; Make SMOD = 0
MOV TH1,#0FDh
; Set up timer 1 for 9600 baud using
MOV TL0,#0FDh
; a 11.059 crystal
MOV TMOD,#20h
MOV TCON,#40h
MOV SCON,#52h
; MODE 1. Set transmit ready flag
RET
Serial I/O is really straightforward, as shown in the following subroutines:
Содержание MicroPac 535
Страница 22: ...APPENDIX D MicroPac 535 Schematics...
Страница 23: ......
Страница 24: ......
Страница 25: ......
Страница 26: ......