150 likes | 332 Views
SERIAL COMMUNICATION. DATA TRANSFER. Two methods – serial and parallel Parallel – number of lines Used for short distance data transfer Serial – used for long distance communication One bit is transferred at a time. 8051 has serial communication capability.
E N D
DATA TRANSFER • Two methods – serial and parallel • Parallel – number of lines • Used for short distance data transfer • Serial – used for long distance communication • One bit is transferred at a time. • 8051 has serial communication capability.
Asynchronous commn. And data framing • Character oriented transmission • Character is placed between start and stop bits. • This is called framing • LSB is sent out first. • I is referred to as mark • 0 is referred to as space • Start bit is send first followed by D0 • Stop bit indicated end of character. • Overhead is high about 20%
Data transfer rate • Rate in serial data transfer starts in bps • Another terminology is baud rate. • Baud rate is the number of changes per second. • A single change of signal may transfer several bits of data.
RS – 232 STANDARDS • To allow compatibility among data commn. Equipment. • Interfacing standard RS -232 • Set by EIA – electronic industries association • Most widely used serial I/O interfacing • This standard is used in PCs and other equipments • This standard was set before the advent of TTL logic family. • Its input and output voltage levels are not TTL compatible.
In RS-232 1 is represented by -3 to -25V • 0 - +3 to +25V • -3 to +3 undefined. • To connect RS-232
Basics of serial communication • Communication with outside world • Data in byte sized chunks • Parallel communication is expensive • So serial communication is used. • Serial communication provides data transfer over telephone lines. • Parallel to serial conversion is done using shift registers.
Conversion is done by modem. • Modulate and demodulate. • Serial commn. – two methods • Synchronous and asynchronous. • Sinc. –transfer a block of data at a time • Async. – transfers a byte of data • Program can be done , but tedious. • So special IC chips are made for data communication.
These chips are USART or UART • Universal synchronous asynchronous receiver transmitter • 8051 has a built in UART. • Half duplex, simplex and full duplex
RS -232 • DB 25 connector • All the pins are not used. • IBM introduced the DB -9 version. • Used only 9 pins.
Data Communication Classification • DTE - terminals and computers • DCE – modem and data transferring equipments • Simplest connection between PC and MC requires minimum three pins • TxD, RxDand GND. • RxD and TxD pins can be interchanged.
RS 232 handshaking signals • For reliable txion. Data transfer must be coordinated. • Handshaking signals • They are not supported by 8051. • 1.DTR – data terminal ready. • Active low signal. • 2.DSR – data set ready • Active low signal
3 RTS – request to send. • 4.CTS – clear to send • 5DCD – data carrier detect. • 6 RI • DTR and DSR are used by PC and modem • RTS and CTS control the flow of data
8051 Connection to RS - 232 • RS232 standard is not TTL compatible. • It requires line driver MAX 232 chip to convert voltage levels. • RxD and TxD pins in 8051 • Transferring and receiving data serially • These two pins are part of port3 - P3.0 – RxD and P3.1 – TxD • These pins are TTl compatible. • To make RS 232 compatible MAX 232 is used.
MAX 232 • SCON register • SBUF register • For serial communication • Data must be placed in SBUF