Sie sind auf Seite 1von 32

Serial Communication Protocols

13-02-13

Dedicated to

New Learners by K.Viswanath

Contenido.

Mode of Communication Clock Pulse and Its significance. Asynchronous and synchronous Protocol. UART(RS232/485/422). SPI(Serial Peripheral Interface). I2C(Inter Integrated Circuit). Methods of SW Implementation. Interfacing with Peripherals

Mode of Communication

Clock Pulse and Its significance


In electronics and especially synchronous digital circuits, a Clock Signal is a particular type of signal that oscillates between a high and a low state and is utilized like a metronome. Metronome is a machine, to coordinate actions of circuits.

Although the word signal has a number of other meanings, the term here is used for "transmitted energy that can carry information". In other words to say which drives other peripherals.

Application
A metronome is any device that produces regular, metrical ticks (beats, clicks) settable in beats per minute.

These ticks represent a fixed, regular aural pulse.

Mechanical metronome

Difference Asynchronous and synchronous


In asynchronous serial transmission, each character is packaged in an envelope, and sent across a single wire, bit by bit to a receiver. Because no signal lines are used to convey clock (timing) information, this method groups data together into a sequence of bits (5-8), then prefixes them with a start bit and appends the data with a stop bit. This is very flexible but has a lot of overhead.

In synchronous transmission, envelop the information, but with more characters between the start and end sequences. The start and stop bits are replaced with a new format that permits greater flexibility. An extra ending sequence is added to perform error checking. Receiver and Transmitter are synchronized by a clock signal, either transmitted over a separate wire. More data can be sent after a short synchronizing sequence. Which achieves Lower overhead and thus, greater throughput.

Difference Asynchronous and synchronous

Ex: SPI and I2C.

UART(RS232/485/422)
A Universal Asynchronous Receiver/Transmitter. UARTs are commonly used in conjunction with communication standards such as EIA, RS-232, RS-422 or RS-485. The electric signaling levels and methods (such as differential signaling etc.) are handled by a driver circuit external to the UART.

Bit Time = 1/Baud Rate One frame contains 1+8+1 = Start Bit + Data Byte + Stop bit

Character framing

RS232
RS-232(Recommended Standard 232) is a standard for serial binary data signals connecting between a Data Terminal Equipment (DTE) and a Data Communication Equipment (DCE). Significant differences between TTL level UART and RS-232 is the voltage level. Valid signals in RS-232 are 3 to 15V, and signals near 0V is not a valid RS-232 level. Besides voltage level, the RS-232 also has a few extra pins specifically designed for the communication between PC and modem. The pinouts of the DB-9 and their functions

RS232 DB9 Connector


Name Pin Description

Transmitted Data (TxD) Received Data (RxD) Request to Send (RTS) Clear to Send (CTS) Data Terminal Ready (DTR)

3 2 7

Serial data output Serial data input This line informs the DCE (Modem) that the DTE (PC) is ready to exchange data This line indicates that the DCE is ready to exchange data Asserted by DTE to indicate that it is ready to be connected

8 4

Data Set Ready (DSR)

Asserted by DCE to indicate the DCE is powered on and is ready to receive commands or data for transmission from the DTE Asserted by DCE when a connection has been established with remote equipment Asserted by DCE when it detects a ring signal from the telephone line

Data Carrier Detect (DCD)

Ring Indicator (RI)

interfacing microcontroller to PC serial port

RS-422 - RS-485
RS-422 (also EIA-422) is a technical standard that specifies electrical characteristics of a digital signaling circuit. Differential signaling can transmit data at rates as high as 10 million bits per second, or may be sent on cables as long as 1500 meters. Some systems directly interconnect using RS-422 signals, or RS-422 converters may be used to extend the range of RS-232 connections. The standard only defines signal levels; other properties of a serial interface are set by other standards EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the electrical characteristics of drivers and receivers for use in balanced digital multipoint systems. The standard is published by the Telecommunications Industry Association/Electronic Industries Alliance (TIA/EIA). Digital communications networks implementing the EIA-485 standard can be used effectively over long distances and in electrically noisy environments. Multiple receivers may be connected to such a network in a linear, multi-drop configuration. These characteristics

SPI (Serial Peripheral Interface)

SPI (Serial Peripheral Interface)

SPI (Serial Peripheral Interface)

I2C.

I2C Bus Arbitration:

Methods of SW Implementation

Polling Method. Interrupt Method. Bit-banging or peripheral in Controller


SW Development Steps: Configuration. Reception. Transmission. Error Status/Acknowledgement.

SW Development Steps:
Polling Method. Ex: UART: for Transmission : while(Transmitter empty flag & UxTCTL) { // source code lines }

For Reception mostly Interrupt method is used ( either peripheral IO or GPIO interrupt for bit banging) Interrupt Method. Ex: UART: for Transmission : 1. Place the Data into the UART_TxBUFFER_REGISTER Enable the Interrupt Flag in the UART Interrupt Register. 2. Few code lines will be placed in the Tx Interrupt, to check the end of the data Byte.

Das könnte Ihnen auch gefallen