ECE 371- Unit 11 Introduction to Serial I/O
TWO MAJOR CLASSES OF SERIAL DATA INTERFACES ASYNCHRONOUS SERIAL I/O - USES “FRAMING BITS” (START BIT AND STOP BIT(S)) WITH EACH CHARACTER
idle Start bit lsb msb Parity bit Stop bit(s) Data value transmitted is Parity bit shown represents even parity option Asynchronous Serial Data Format
SYNCHRONOUS SERIAL I/O - USES SINGLE “SYNCH” CHARACTER AT BEGINNNG OF DATA STREAM OR - USES SPECIAL CLOCK SIGNAL TO DEFINE BEGINNING OF EACH NEW CHARACTER
Synch charData char Header information Data char etc Synchronous Serial Data Transmission Format OR Data char
CLASSES OF SERIAL DATA APPLICATION COMPUTER TO PERIPHERAL DEVICE COMPUTER TO COMPUTER
Computer System Peripheral Device Serial data Handshaking Signals Ground Half-duplex Serial Data Interface Between Computer and Peripheral Device
Computer System Peripheral Device Serial data Handshaking Signals Ground Full-duplex Serial Data Interface Between Computer and Peripheral Device
Computer (DTE) Modem Telephone System Modem Computer (DTE) Serial Data Communication Between Computers, Using Modems RS-232 Standard Interface RS-232 Standard Interface DCE Data Communication Equipment DTE = Data Terminal Equipment RS-232 is a Standard Interface between DTE and DCE
Laptop COM1 Port CPU Asynchronous Serial Interface Modem Telephone Line Inside PC
RS-232 Standard Interface Defines a 25-bit Connector Defines the function of each pin Defines EIA RS-232 Logic Levels –Serial Data Physical Representation Logic “1”:-25 volts ≤ V 1 ≤ -5 volts Logic “0”: +5 volts ≤ V 0 ≤ +25 volts
TXD RXD GND RTS CTS DCD DSR DTR RI DCE EIA RS-232 Signals of Interest DTE
Primary RS-232 Signals RxD -- Received Data TxD --Transmitted Data RTS – Request to Send CTS – Clear to Send DTR – Data Terminal Ready - DTE Ready DSR – Data Set Ready – DCE Ready RI – Ring Indicator DCD – Data Carrier Detect GND -- Ground
EIA RS-232 Interface
COM Connector on PC
SERIAL COMMUNICATION INTERFACE (SCI) ON THE MC9S12DP256B MICROCONTROLLER ASYNCHRONOUS SERIAL I/O COMPATIBLE WITH RS232 STANDARD
SCI Data Formats See p. 211, text, for def.
Serial Data Format Idle (no data being transmitted) = “1” Start = “0” Stop =“1” Each data bit is T seconds in length Baud = 1/T Least Significant Bit Sent First Most Significant Bit Sent Last
ASCII Code for Letter A = 0b = 0x41 ASCII Code for Letter B = 0b = 0x42 ASCII Code for Digit 1 = 0b = 0x31 Idle Start LSB MSB Stop A = B = =
ASCII Character Set 7-bit Characters d6 d5 d4 d3 d2 d1 d0 0 0 x x x x x Control Characters 0 1 x x x x x Numbers and Punctuation 1 0 x x x x x Upper Case Characters 1 1 x x x x x Lower Case Characters Ctrl J = Line Feed Ctrl M = Carriage Return Ctrl Q = XON Ctrl S = XOFF Ctrl Z = End of File
2 Asynchronous Serial Ports SCI0 and SCI1 SCI0 – Uses Port S[1:0] SCI1 – Uses Port S[3:2]
RS-232 TTL Level Converters
TTL – RS-232 Conversion Channel 0 RTS = CTS DCD = DTR = DSR RI – No Connection Channel 1 Data Lines Only TTL – RS-232 Conversion DC to DC Power Supply