You are on page 1of 16

5

Data Communication Concepts Within a microcomputer data is transferred in parallel, because

that is the fastest way to do it. For transferring data over long distances, however, parallel data transmission requires too many wires. Therefore, data to be sent long distances is usually converted from parallel form to serial form so that it can be sent on a single wire or pair of wires. Serial data received from a distant source is converted to parallel form so that it can be easily transferred on the microcomputer buses. i. Serial Interface Basic concepts concerning the serial communication can be classified into categories below: Interfacing requirements Transmission format Error check in data communication Standards in serial I/O Ii/Interfacing Requirements The serial interface requirement is very much similar to parallel interface requirement. Computer identifies the peripheral through port address and enable if using the read and write signals. The primary difference between the parallel I/O and serial I/O is the number of lines used for data transfer. Parallel I/O requires the entire bus while the serial I/O requires only one or pair of data lines for communication. ii. Transmission Format Transmission format for communication is concerned with the issues such as synchronization, direction of data flow, speed, errors and

medium of transmission. Serial data can be sent synchronously or asynchronously. iii. Synchronous Data Transmission For synchronous data transmission data is sent in blocks at a constant rate. The start and end of the block are identified with specific bytes or bit patterns. iv. Asynchronous Data Transmission For asynchronous transmission each data character has a bit which identifies its start and 1 or 2 bits, which identifies its end. Since each character is individually identified, characters can be sent at any time (asynchronously), in the same way that a person types on a keyboard. The asynchronous format is character oriented. Each character carries the information of the start and stop bits. When no data is being transferred ,a receiver stage high at the logic 1 called mark; logic 0 is called space. The transmission of data begins with one start bit (low) followed by a character and one or two stop bits (high). This is known as framing. The asynchronous format is generally used in low speed transmission (less than 20k bits/sec) in serial I/O one bit is sent out at a time. Therefore how long the bit stays on or off is determined by the speed at which bits are transmitted. The receiver should be set up to receive the bits at the same rate of transmission; otherwise the receiver may not be able to differentiate between the two consecutive 0s and 1s. The rate at which the bits are transmitted (bits/sec) is called baud. Each equipment has its own baud requirements. The figure shown below shows how the ASCII character A (41) will be transmitted with the 1200 baud with the framing information of one start and one stop bit.

The bit time (delay between any two successive bits) is 0.83ms; this is determined by the baud as follows.

Mark Start Bit Transmission Data Fig. 2.6 Asynchronous Data Format v. Error Check In Data Communication During transmission, various types of errors can occur. These errors need to be checked, therefore, additional information for error checking is sent during transmission the receiver can check the received data against the error check information, and if the error is detected, the receiver can request there retransmission of that data segment. Three methods generally used for this purpose are parity check, checksum and redundancy check. vi. Standard in Serial I/O The serial I/O technique is commonly used to interface terminals, printers etc. a standard is normally defined by a professional organization (such as IEEE). A standard may include such items as assignment of pin positions for signals, voltage levels, speed of data transfer, length of cable and mechanical specifications. When data are transmitted as voltage, the commonly used standard is known as Stop Bit

RS232C. it is defined as reference to data terminal equipment (DTE) and data communication equipment (DCE). The rate of transmission is RS232C is restricted to a maximum of 20k baud and a distance of 50 feet.
Serial Port Description The electrical speifications of the serial port are contained in the EIA { Electronics industry Association} RS232 standard It states many parameters such as 1. A Space {logic 0} will between +3 and +25 Volts. 2. A Mark {logic 1} will between -3 and -25 Volts. 3. The region between +3 and -3 volts is undefined. 4. An open circuit voltage should never exceed 25 volts.{In Reference to GND} 5. A short circuit current should not exceed 500 ma.The driver should be able to handle this without damage. These connectors come in two forms: A male and a female connector. There are the DType 9 pin connector and D-Type pin connector both of which are male on the back of the PC.The female connector has holes that allow the pins on the male end to be inserted into the connector.

DB-9 This is a female DB-9 connector:

The female DB-9 connector is typically used as the "plug" that goes into a typical PC. If you see one of these on the back of your computer, it is likely not to be used for serial communication, but rather for things like early VGA or CGA monitors (not SVGA) or for some special control/joystick equipment. And this is a male DB-9 connector:

This is the connector that you are more likely to see for serial communications on a "generic" PC. Often you will see two of them side by side (for COM1 and COM2). Special equipment that you might communicate with would have either connector, or even one of the DB-25 connectors listed below.

DB-25
This is a female DB-25 connector:

This is what you normally find on the end of a traditional parallel printer cable on a PC. This connector type is also used frequently for equipment that conforms to RS-232 serial data communication as well, so don't always assume if you see one of these connectors that it is always parallel. When the original RS-232 specification was written, this was originally the kind of connector that was intended, but because many of the pins were seldom if ever used, it was switched to the DB-9 connectors on more recent equipment like the original IBM-PC (yes, that is comparatively recent equipment for this standard). This is a male DB-25 connector:

Male DB-25 connectors are usually used on a PC for parallel data communication, which is beyond the scope of this series of articles. However, you should still be aware that this connector is also used for serial communications on many different types of equipment. In fact, if you have a random piece of equipment that you are trying to see how it works, you can presume that it is a piece of serial equipment. Hacking random connectors is also beyond the scope of this document, but it can be an interesting hobby by itself.

Pin connections for 9 pin connectors


9 Pin Connector on a DTE device (PC connection) Male RS232 DB9

Pin Number 1 2 3 4 5 6 7 8 9

Direction of signal: Carrier Detect (CD) (from DCE) Incoming signal from a modem Received Data (RD) Incoming Data from a DCE Transmitted Data (TD) Outgoing Data to a DCE Data Terminal Ready (DTR) Outgoing handshaking signal Signal Ground Common reference voltage Data Set Ready (DSR) Incoming handshaking signal Request To Send (RTS) Outgoing flow control signal Clear To Send (CTS) Incoming flow control signal Ring Indicator (RI) (from DCE) Incoming signal from a modem

25 Pin Connector on a DTE device (PC connection) Male RS232 DB25 Pin Number

Direction of signal:

1 2 3

Protective Ground Transmitted Data (TD) Outgoing Data (from a DTE to a DCE) Received Data (RD) Incoming Data (from a DCE to a DTE) Request To Send (RTS) Outgoing flow control signal controlled by DTE Clear To Send (CTS) Incoming flow control signal controlled by DCE Data Set Ready (DSR) Incoming handshaking signal controlled by DCE Signal Ground Common reference voltage Carrier Detect (CD) Incoming signal from a modem Data Terminal Ready (DTR) Outgoing handshaking signal controlled by DTE Ring Indicator (RI) Incoming signal from a modem

7 8

20

22

Serial pinouts[D 25 and D9 Connectors]


9-pin 25-pin 1 2 8 3 pin definition DCD (Data Carrier Detect) RX (Receive Data)

3 4 5 6 7 8 9

2 20 7 6 4 5 22

TX (Transmit Data) DTR (Data Terminal Ready) GND (Signal Ground) DSR (Data Set Ready) RTS (Request To Send) CTS (Clear To Send)) RI (Ring Indicator)

The TD (transmit data) wire is the one through which data from a DTE device is transmitted to a DCE device. This name can be deceiving, because this wire is used by a DCE device to receive its data. The TD line is kept in a mark condition by the DTE device when it is idle. The RD (receive data) wire is the one on which data is received by a DTE device, and the DCE device keeps this line in a mark condition when idle. RTS stands for Request To Send. This line and the CTS line are used when "hardware flow control" is enabled in both the DTE and DCE devices. The DTE device puts this line in a mark condition to tell the remote device that it is ready and able to receive data. If the DTE device is not able to receive data (typically because its receive buffer is almost full), it will put this line in the space condition as a signal to the DCE to stop sending data. When the DTE device is ready to receive more data (i.e. after data has been removed from its receive buffer), it will place this line back in the mark condition. The complement of the RTS wire is CTS, which stands for Clear To Send. The DCE device puts this line in a mark condition to tell the DTE device that it is ready to receive the data. Likewise, if the DCE device is unable to receive data, it will place this line in the space condition. Together, these two lines make up what is called RTS/CTS or "hardware" flow control. The Software Wedge supports this type of flow control, as well as Xon/XOff or "software" flow control. Software flow control uses special control characters transmitted from one device to another to tell the other device to stop or start sending data. With software flow control the RTS and CTS lines are not used. DTR stands for Data Terminal Ready. Its intended function is very similar to the RTS line. DSR (Data Set Ready) is the companion to

DTR in the same way that CTS is to RTS. Some serial devices use DTR and DSR as signals to simply confirm that a device is connected and is turned on. The Software Wedge sets DTR to the mark state when the serial port is opened and leaves it in that state until the port is closed. The DTR and DSR lines were originally designed to provide an alternate method of hardware handshaking. It would be pointless to use both RTS/CTS and DTR/DSR for flow control signals at the same time. Because of this, DTR and DSR are rarely used for flow control. CD stands for Carrier Detect. Carrier Detect is used by a modem to signal that it has a made a connection with another modem, or has detected a carrier tone. The last remaining line is RI or Ring Indicator. A modem toggles the state of this line when an incoming call rings your phone. The Carrier Detect (CD) and the Ring Indicator (RI) lines are only available in connections to a modem. Because most modems transmit status information to a PC when either a carrier signal is detected (i.e. when a connection is made to another modem) or when the line is ringingthese two lines are rarely used Port Addresses and IRQs in the PC are as given below Name COM 1 COM 2 COM 3 COM 4 Addresses 3F8 2F8 3E8 2E8 IRQ 4 3 4 3

RS-232 communication is asychronous.That is a clock signal is not sent with the data. Each word is synchronized using it,s start bit, and an internal clock on each side, keeps tabs on the timing.

2.5.6 MAX 232 (communication interface) This chip is used when interfacing micro controller with PC to check the Baud rate and changes the voltage level because micro controller is TTL compatible whereas PC is CMOS compatible. The MAX 232 IC contains the necessary drivers{two} and receivers {two}, to adapt the RS- 232 signal voltage levels to TTL logic.It became popular,because it just needs one voltage{+5V} and generates the necessary RS-232 voltage levels{approx -10V AND +10V} internally.This greatly simplified the design of circuitry.And this made the IC so popular.MAX232 is just a driver/receiver.It does not generate the necessary RS-232 sequence of marks and spaces with the right timing,it does not decode RS-232 signal, it does not provide a serial /parallel conversion.All it does is to convert signal voltage levels.

General Description The MAX220MAX249 family of line drivers/receivers is intended for all EIA/TIA-232E and V.28/V.24 communications interfaces, particularly applications where 12V is not available. These parts are especially useful in battery-powered systems, since their low-power shutdown mode reduces power dissipation to less than 5W.

Applications
Portable Computers Low-Power Modems Interface Translation Battery-Powered RS-232 Systems

Multidrop RS-232 Networks

Features
1. Superior to bipolar 2. Low-power receive mode in shutdown 3. Meet all EIA/TIA-232E and v.28 specifications. 4. 3-state driver and receiver output. The MAX220MAX249 contain four sections: dual charge-pump DC-DC voltage converters, RS-232 drivers, RS-232 receivers, and receiver and transmitter enable control inputs.

Dual Charge-Pump Voltage Converter


The MAX220MAX249 have two internal charge-pumps that convert +5V to 10V (unloaded) for RS-232 driver operation. The first converter uses capacitor C1 to double the +5V input to +10V on C3 at the V+ output. The second converter uses capacitor C2 to invert +10V to -10V on C4 at the V- output. A small amount of power may be drawn from the +10V (V+) and -10V (V-) outputs to power external circuitry except on the MAX225 and MAX245MAX247, where these pins are not available. V+ and V- are not regulated, so the output voltage drops with increasing load current. Do not load V+ and V- to a point that violates the minimum 5V EIA/TIA232E driver output voltage when sourcing current from V+ and V- to external circuitry. When using the shutdown feature in the MAX222, MAX225, MAX230, MAX235, MAX236, MAX240, MAX241, and MAX245MAX249, avoid using V+ and V to power external circuitry. When these parts are shut down, V- falls to 0V, and V+ falls to +5V. For applications where a +10V external supply is applied to the V+ pin (instead of using the internal charge pump to generate +10V), the C1 capacitor must not be installed and the SHDN pin must be tied to VCC. This is because V+ is internally connected to VCC in shutdown mode.

RS-232 Drivers
The typical driver output voltage swing is 8V when loaded with a nominal 5k RS-232 receiver and VCC = +5V. Output swing is guaranteed to meet the EIA/TIA- 232E and V.28 specification, which calls for 5V minimum driver output

levels under worst-case conditions. These include a minimum 3k load, VCC = +4.5V, and maximum operating temperature. Unloaded driver output voltage ranges from (V+ -1.3V) to (V- +0.5V). Input thresholds are both TTL and CMOS compatible. The inputs of unused drivers can be left unconnected since 400k input pull-up resistors to VCC are built in (except for the MAX220). The pull-up resistors force the outputs of unused drivers low because all drivers invert. The internal input pull-up resistors typically source 12A, except in shutdown mode where the pull-ups are disabled. Driver outputs turn off and enter a high-impedance statewhere leakage current is typically microamperes (maximum 25A)when in shutdown mode, or when in three-state mode, device power is removed. Outputs can be driven to 15V. The power supply current typically drops to 8A in shutdown mode. The MAX220 does not have pull-up resistors to force the outputs of the unused drivers low. Connect unused inputs to GND or VCC. The MAX239 has a receiver three-state control line, and the MAX223, MAX225, MAX235, MAX236, MAX240, and MAX241 have both a receiver three-state control line and a low-power shutdown control. The receiver TTL/CMOS outputs are in a high-impedance, threestate mode whenever the three-state enable line is high (for the MAX225/MAX235/MAX236/MAX239 MAX241), and are also high-impedance whenever the shutdown control line is high. When in low-power shutdown mode, the driver outputs are turned off and their leakage current is less than 1A with the driver output pulled to ground. The driver output leakage remains less than 1A, even if the transmitter output is back driven between 0V and (VCC + 6V). Below -0.5V, the transmitter is diode clamped to ground with 1k series impedance. The transmitter is also zener clamped to approximately VCC + 6V, with a series impedance of 1k. The driver output slew rate is limited to less than 30V/s as required by the EIA/TIA232E and V.28 specifications. Typical slew rates are 24V/s unloaded and 10V/s loaded with 3 and 2500pF.

RS-232 Receivers
EIA/TIA-232E and V.28 specifications define a voltage level greater than 3V as logic 0, so all receivers invert. Input thresholds are set at 0.8V and 2.4V, so receivers respond to TTL level inputs as well as EIA/TIA-232E and V.28 levels. The receiver inputs withstand an input over voltage up to 25V and provide input terminating resistors with nominal 5k

values. The receivers implement Type 1 interpretation of the fault conditions of V.28 and EIA/TIA-232E. The receiver input hysteresis is typically 0.5V with a guaranteed minimum of 0.2V. This produces clear output transitions with slow-moving input signals, even with moderate amounts of noise and ringing. The receiver propagation delay is typically 600ns and is independent of input swing direction.
U 1 3 3 3 3 3 3 3 3 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 19 18 9 31 C 1 + P P P P P P P P P P P P P P P P 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 .0 .1 .2 .3 .4 .5 .6 .7 .0 .1 .2 .3 .4 .5 .6 .7 /A /A /A /A /A /A /A /A D D D D D D D D 0 1 2 3 4 5 6 7 P P P2 P2 P2 P2 P2 P2 2 .0 /A 2 .1 /A .2 /A 1 .3 /A 1 .4 /A 1 .5 /A 1 .6 /A 1 .7 /A 1 8 9 0 1 2 3 4 5 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 2 VC C R 2 R E S IS TO R D 2

C 2

P 3 .0 /R XD P 3 .1 /T XD P 3 .2 /IN T O P 3 .3 /IN T 1 P 3 .4 /T O P 3 .5 /T 1 P 3 .6 /W R P 3 .7 /R D PSEN A L E /P R O G

LED BC 547

VC C

OPTICAL TX

C 3

XTA L1 XTA L2 R ST E A /V P P AT89C 51

29 30

R 1

VC C
39 38 37 36 35 34 33 32

U1 P0.0/AD0 P0.1/AD1 P0.2/AD2 P0.3/AD3 P0.4/AD4 P0.5/AD5 P0.6/AD6 P0.7/AD7 1 2 3 4 5 6 7 8 19 18 P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 XTAL1 XTAL2 RST EA/VPP AT89C51 VCC P2.0/A8 P2.1/A9 P2.2/A10 P2.3/A11 P2.4/A12 P2.5/A13 P2.6/A14 P2.7/A15 P3.0/RXD P3.1/TXD P3.2/INTO P3.3/INT1 P3.4/TO P3.5/T1 P3.6/WR P3.7/RD PSEN ALE/PROG 21 22 23 24 25 26 27 28 10 11 12 13 14 15 16 17 29 30 VCC

LED LED LED LED LED LED LED LED C2 C3 VCC + C1

VCC D3 2 VCC PHOTODIODE 1 1 R5 2 2 BC547 3 1 BC547 3 R4 R6

31

OPTICAL RX

R1

You might also like