RS232C
RS232C
RS232C
Serial Interface
Handshaking
Asynchronous Techniques
Decoding Serial Bit Steams and Error Detection
Transmission Line Considerations
Line Drivers and Receivers
Voltage and Mechanical Definitions of the RS-232C Standard
Practical Use of the Asynchronous Communication Adapter
Data Acquisition using Serial Interface
Fiber Optics
1
Serial Interface
Parallel Vs. Serial
Using Serial than Parallel 1 clock for 4 bit transfer
Transmitting data to a
relatively distance
peripherals
Requires only one data
wire
8 wires for parallel
Less cable, line drivers
and receivers
Esp. Long distance
4 clock for 4 bit transfer
To use commercial
communication facilities
such as regular telephone
or data lines
Chap 0 2
Handshaking
DTE (Data Terminal
Process of using signals to Equipment)
establish conditional Terminal or Computer
communication
DCE (Data
Process Communications
Transmitter activate RTS Equipment)
Receiver senses CTS by Modem or Printer
interrupt or Polling
Receiver activate RTS
Transmitter senses CTS
Transmitter waits until
CTS input is activated
Transmitter send Data
Chap 0 3
Asynchronous Techniques
Example of Sending ‘S’
Serial Communication Start + 7 bit Data + Parity
Asynchronous + Stop bit
No Clock information Start: 1 bit
One character at a time Data: 5 ~ 8 bit
Intel 8250 UART Parity: Even/ Odd/ None
• Universal Stop: 1 ~ 2 bit
Asynchronous
Receiver Transmitter
Clock frequency is integer
Bit Rate
multiple of bit rate
• 50 ~ 5.6Kbps (Typically 16 times)
Synchronous
Clock information
Many character or bit
stream
Chap 0 4
Using UART
Receiving Data
UART receives serial data
Extract Data
• Save in Rx_DATA Register
Initialize UART
• Error check
Thru Control Register
– Parity Error
Character Length – Overrun Error
Parity – Framing Error
Number of Stop Bit CPU read data
Baud Rate Thru Rx_DATA Register
Transmitting Data Fast read
Write Data to UART Read same data many times
Thru Tx_DATA Register
Check Rx_RDY before read
data
UART send serial data Slow read
Start, Parity, Stop bit is
added
Lost of data
Rx Overrun Error
Fast write data to UART
Tx Underrun Error
Check Tx_RDY before write
data to UART
Chap 0 5
Error Detection
Character Error
Generating Checksum
1 Byte Checksum
Parity Error
Overrun Error
Sum of all bytes in Block
Framing Error
2’s complement of sum
LRC (Longitudinal Redundancy
Block Error Check Check)
Checksum (1 ~ 2 Byte) is • EXOR of all bytes in Block
added to a Block (128 or 256 2 Byte Checksum
Byte) Widely used in synchronous
Transmitter and Receiver communication
uses Same algorithm CRC (Cyclic Redundancy Check)
If received checksum = • 16 bit reminder of polynomial
generated checksum division
Send ACK See Fig 6.5, For CRC generation
If received checksum Most communication chipset
generated checksum generate and check CRC
Send NAK
Chap 0 6
Transmission Line Considerations
Reflections
To construct satisfactory Load is not matched to the
communication link line
Transmission cable is no Terminates the line
more negligible R
Signal Attenuation
Long cable length For very long lines
Use Signal repeater
High transmission
frequency
Signal Distortion and
Crosstalk
Transmission line model Limit the transmission speed
G = Conductance / unit
Capacitance of line
length Limit on the length of line
Influence rise time
Differences in Ground level
Use one common ground
Chap 0 7
Line Drivers and Receivers
The line capacitance and
Single-Ended Interface
current-drive capacity of RS-232C (Version C)
source limit length of line MC1488, MC1489
TTL drive: < 70cm SN75188, SN75189
Line Drivers and Receivers Line Length < 17m
Increase range of Data rate < 20Kbaud
transmission
EIA (Electronics Industries
Association)
Set standard for line
driver and receiver
RS-232, RS-422, RS-423
is popular
Chap 0 8
Line Drivers and Receivers
Unbalanced Differential
Interface
Balanced Differential RS-423
Interface
RS-422
Ground return is
common to several
Greatest Noise Margin signal lines
• Immune to Common MC3486, MC3487
mode noise
TI9636, TI9637
MC3486, MC3487
Line Length < 1300m
TI9636, TI9637
Data rate < 100Kbaud
Line Length < 1300m
Data rate < 10Mbaud
Chap 0 9
Voltage and Mechanical Definition of The
RS-232C Standard
RS-232 Standard
EIA RS-232C signal
Developed to interface levels
DTE to DCE
Now used to interface
almost any devices
including another PC
25-Pin D connector
Currently 9-Pin is
popular
Chap 0 10
Pinout of
DB25 connector
RTS
Activated by transmitter when it
wishes to send
CTS
Used by receiver to inform the
transmitter whether or not receiver
is ready
DSR
Active when Modem is powered on
DCD
Used by Modem to signal the
transmitter that the link is usable
DTR
Indication from the terminal that it is
in the on-line mode
RI
Activated by Modem when it detects
an incoming call on the telephone
line
Chap 0 11
Practical Use of the Asynchronous
Communication Adapter
IBM PC has UART
Initializing Asynchronous
Adapter
Logical Device Name With DOS
COM1: and COM2: MODE
• Different Interrupt COM1:12,N,8,1,P
• 1200 bps, No Parity
Handshaking lines fro • 8 bit Data, 1 Stop bit
operation should be • Serial Printer
Operation
connected properly MODE LPT1:=COM1:
Critical Signals • Redirect the LPT1:
channel to COM1:
Pin5 CTS device
Pin6 DSR Control with Basic
Pin8 CD OPEN “COM1:”,”1200”,
”N”,”8”,”1”,”P”
Chap 0 12
RS-232C Interface Cabling
Ideal Case
Minimal Cabling
Chap 0 13
RS-232C Interface Cabling
Cabling to handshake
Null Modem Adapter
Diablo 630 printer for connecting IBM PC
wired as DTE to another DTE-type
Devices
Chap 0 14
RS-232C Interface Cabling
Loopback Plug for
Loopback Test
testing a Serial Port Internal
Inside Chipset
External
TTL Level
RS-232C Level
Modem Level
Device Level
Chap 0 15
Data Acquisition using Serial Interface
Computer control of
Applications
remote sensing devices Monitoring the
connected through a serial temperatures at various
interface stages in
manufacturing process
Each device sample
temperature
Report the result to
the IBM PC when
requested
See Appendix A, For
commercial data
acquisition products
Chap 0 16
HP39301A
Fiber Optics
16 channel RS-232 to
Fiber optic multiplexer
Extension of 16
Better performance in independent 19.2Kbaud
the presence of full duplex channel
Up to 1000m with single
electrical noise optical cable
Wider Bandwidth
Higher Data Rate
More channel can be
multiplexed per cable
Cable is delicate and
easily damaged
Chap 0 17