microprocessors interfacing
play

Microprocessors & Interfacing Concepts Standards USART in - PowerPoint PPT Presentation

Lecture Overview Serial Communication Microprocessors & Interfacing Concepts Standards USART in AVR Serial Input/Output Lecturer : Dr. Annie Guo S2, 2008 COMP9032 Week10 1 S2, 2008 COMP9032 Week10 2 Serial


  1. Lecture Overview • Serial Communication Microprocessors & Interfacing – Concepts – Standards • USART in AVR Serial Input/Output Lecturer : Dr. Annie Guo S2, 2008 COMP9032 Week10 1 S2, 2008 COMP9032 Week10 2 Serial Communication System Why Serial I/O? Structure • Problems with Parallel I/O: Data From Source Data To Destination – Needs a wire for each bit. n – When the source and destination are more than a n few feet the parallel cable can be bulky and Received Data expensive. Transmit Data Buffer Buffer – Susceptible to reflections and induced noises for long distance communication. Serial Data R clock T clock Serial In/Parallel Parallel In/Serial • Serial I/O overcomes these problems. Out Shift Register Out Shift Register RECEIVER TRANSMITTER S2, 2008 COMP9032 Week10 3 S2, 2008 COMP9032 Week10 4

  2. Serial Communication System Serial Communication System Structure (cont.) Structure (cont.) • At the communication source: • At the communication destination: – The parallel interface transfers data from the – R clock shifts each bit received into the Serial In source to the transmit data buffer. Parallel Out (SIPO) register. – The data is loaded into the Parallel In Serial Out – After all data bits have been shifted in, they are (PISO) register and T clock shifts the data bits out transferred to the received data buffer. from the shift register to the receiver. – The data in the received data buffer can be read by an input operation via the parallel interface. S2, 2008 COMP9032 Week10 5 S2, 2008 COMP9032 Week10 6 Serial Communication Synchronous VS Asynchronous • There are two basic types of serial • Synchronous communications – Transmitter and receiver are synchronized – synchronous • Need extra hardware for clock synchronization – Having faster data transfer rate – asynchronous • Asynchronous – Transmitter and receiver use different clocks. No clock synchronization is required. – Used in many applications such as keyboards, mice, modems – The rest of this lecture focuses on Asynchronous communication S2, 2008 COMP9032 Week10 7 S2, 2008 COMP9032 Week10 8

  3. UART UART Structure • The device that implements both transmitter and receiver in a single integrated circuit is called a UART (Universal Asynchronous Receiver/Transmitter). • UART uses least significant first order T clock1 R clock2 Transmitter Receiver – The least significant bit of data is transferred first Data Bus Data Bus • Data are transmitted asynchronously. R clock1 T clock2 Receiver Transmitter – Clocks on both sides are not synchronized – But receivers have a way to synchronise the data receiving operation with data transmission operation UART UART • UART is the basis for most serial communication hardware. S2, 2008 COMP9032 Week10 9 S2, 2008 COMP9032 Week10 10 UART Data Formats UART Data Formats (cont.) • Typical bits in data transmission: • Before transmission, data should be encoded – Start bit: When the transmitter has data to send, it first – Many encoding schemes, such as ASCII changes the line from the mark to the space level for one bit • Each encoded data is encapsulated with two bits time. This synchronises the receiver with transmitter. When the receiver detects the start bit, it knows to start clocking in – Start bit and stop bit the serial data bits. • Mark and space : the logic one and zero levels are – Data bits: representing a data, such as a character called mark and space. – Parity bit: used to detect errors in the data – When the transmitter is not sending anything, it holds the • For odd parity: the bit makes the total number of 1s in the data odd line at mark level, also called idle level. • For even parity: the bit makes the total number of 1s in the data Stop Optional Least Significant even. Bit Parity Bit Bit – Stop bit: added at the end of data bits. It gives one bit-time Mark between successive data. Some systems require more than one stop bit. Space Data Bits Start Bit S2, 2008 COMP9032 Week10 11 S2, 2008 COMP9032 Week10 12

  4. Data Transmission Rate Communication System Types • The rate at which bits are transmitted is called • Three ways that data can be sent in serial baud rate . communication system: – Simplex system • It is given in bits per second – Full-duplex (FDX) system • Standard data rates – Baud: – Half-duplex (HDX) system 110, 150, 300, 600, 900, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57800 S2, 2008 COMP9032 Week10 13 S2, 2008 COMP9032 Week10 14 Simplex System Full-Duplex (FDX) System – Data are sent in one direction only – Data are transmitted in two directions. • For example, computer to a serial printer. – It is called four-wire system, although only two – Simple signal wires and a common ground are sufficient. • If the computer does not send data faster than the printer can accept it, no handshaking signals are required. – Two signal wires are needed for this system. Terminal Computer Computer Printer S2, 2008 COMP9032 Week10 15 S2, 2008 COMP9032 Week10 16

  5. Standards for the Serial I/O Half-Duplex (HDX) System Interface – Data are transmitted in two directions with only • Interface standards are needed to allow one pair of signal lines. different manufacturers’ equipment to be – Additional hardware and handshaking signals interconnected must be added to an HDX system. • Must define the following elements: – Handshaking signals – Direction of data flow – Types of communication devices. Computer Computer – Connectors and interface mechanical considerations. – Electrical signal levels. S2, 2008 COMP9032 Week10 17 S2, 2008 COMP9032 Week10 18 Standards for the Serial I/O Two RS232-C Connectors Interface (cont.) • Popular standards include RS-232-C, RS- 422, RS-423 and RS-485. – RS-232-C standard is used in most serial interface. – If the signals must be transmitted farther than 50 DE9 pin assignments feet or greater than 20 Kbits/second, another electrical interface standard such as RS-422, RS- 423 or RS-485 should be chosen. – For RS-422, RS-423 and RS-485, handshaking, direction of signal flow, and the types of communication devices are based on the RS-232- DB25 pin assignments C standard. S2, 2008 COMP9032 Week10 19 S2, 2008 COMP9032 Week10 20

  6. RS-232-C Signal Definitions RS-232-C Signal Definitions (cont.) DE9 DB25 Signal Purpose DE9 DB25 Signal Purpose 1 PG Protective ground: this is actually the shield 8 5 CTS Clear to send: Sourced by DCE, received in a shielded cable. It is designed to be by DTE. CTS must be asserted before the connected to the equipment frame and may DTE can transmit data. be connected to external grounds. 6 6 DSR Data set ready: Sourced by DCE and 3 2 TxD Transmitted data: Sourced by DTE and received by DTE. Indicates that the DCE received by DCE. Data terminal equipment has made a connection on the telephone cannot send unless RTS, CTS, DSR and line and is ready to receive data from the DTR are asserted. terminal. The DTE must see this asserted 2 3 RxD Received data: Received by DTE, sourced before it can transmit data. by DCE. 5 7 SG Signal ground: Ground reference for this 7 4 RTS Request to send: Sourced by DTE, received signal is separate from pin 1, protective by DCE. RTS is asserted by the DTE when ground. it wants to send data. The DCE responds by asserting CTS. S2, 2008 COMP9032 Week10 21 S2, 2008 COMP9032 Week10 22 RS-232-C Signal Definitions (cont.) RS-232-C Interconnections • When two serial ports are connected, the data rate, DE9 DB25 Signal Purpose the number of data bits, whether parity is used, the 1 8 DCD Data carrier detect: Sourced by DCE, type of parity, and the number of stop bits must be received by DTE. Indicates that a DCE has set properly and identically on each UART . detected the carrier on the telephone line. • Proper cables must be used. There are four kinds of Originally it was used in half-duplex systems but can be used in full-duplex cables from which to choose, depending on the types systems, too. of devices to be interconnected. – Full DTE – DCE cable 4 20 DTR Data terminal ready: Sourced by DTE and received by DCE. Indicates that DTE is – Minimal DTE – DCE cable ready to send or receive data. – DTE – DTE null modem cable – Minimal null modem cable 9 22 RI Ring indicator: Sourced by DCE and received by DTE. Indicates that a ringing signal is detected. S2, 2008 COMP9032 Week10 23 S2, 2008 COMP9032 Week10 24

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend