60
RS-232 Serial Communications 32-E specification. This standard, which was developed by the Electronic Industry Association  and the Telecommunications Industry Association (EIA/TIA), is more popularly called simply  RS-232, where RS stands for "recommended standard." Although this RS prefix has been replaced in recent years with EIA/TIA to help identify the source of the standard, this paper uses the common RS-232 notation.   Due to its relative simplicity and low hardware overhead (when compared to parallel interfacing),serial communications is used extensively within the electronics industry. Today, the most popular serial communications standard is certainly the EIA/TIA-2 RS-232 Specificatio ns RS-232 is a complete standard. This means that the standard sets out to ensure compatibility between the host and peripheral systems by specifying: 1. Common voltage and signal levels 2. Common pin-wiring configurations 3. A minimal amount of control information between the host and peripheral systems. Unlike many standards which simply specify the electrical characteristics of a given interface, RS-232 specifies electrical, functional, and mechanical characteristics to meet the above three criteria. Each of these aspects of RS-232 standard is discussed below. Electrical Characterist ics  The electrical characteristics section of the RS-232 standard specifies voltage levels, rate of change for signal levels, and line impedance. As the original RS-232 standard was defined in 1962 and before the days of TTL logic, it is no surprise that the standard does not use 5V and ground logic levels. Instead, a high level for the driver output is defined as between +5V to +15V, and a low level for the driver output is defined as between -5V and -15V. The receiver logic levels were defined to provide a 2V noise margin. As such, a high level for the receiver is defined asbetween +3V to +15V, and a low level is between -3V to -15V. Figure 1 illustrates the logic levels defined by the RS-232 standard. It is necessary to note that, for RS-232 communication, a low level (-3V to -15V) is defined as a logic 1 and is historically referred to as "marking." Similarly, a high level (+3V to +15V) is defined  as a logic 0 and is referred to as "spacing."

Lash Sheshi

Embed Size (px)

Citation preview

Page 1: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 1/60

RS-232 Serial Communications

32-E specification. This standard, which was developed by the Electronic Industry Association  

and the Telecommunications Industry Association (EIA/TIA), is more popularly called simply

 RS-232, where RS stands for "recommended standard." Although this RS prefix has been

replaced in recent years with EIA/TIA to help identify the source of the standard, this paper uses

the common RS-232 notation. 

 Due to its relative simplicity and low hardware overhead (when compared to parallel

interfacing),serial communications is used extensively within the electronics industry. Today, the

most popular serial communications standard is certainly the EIA/TIA-2

RS-232 Specifications 

RS-232 is a complete standard. This means that the standard sets out to ensure compatibilitybetween the host and peripheral systems by specifying:

1. Common voltage and signal levels

2. Common pin-wiring configurations

3. A minimal amount of control information between the host and peripheral systems.

Unlike many standards which simply specify the electrical characteristics of a given interface,

RS-232 specifies electrical, functional, and mechanical characteristics to meet the above three

criteria. Each of these aspects of RS-232 standard is discussed below.

Electrical Characteristics 

The electrical characteristics section of the RS-232 standard specifies voltage levels, rate of 

change for signal levels, and line impedance.

As the original RS-232 standard was defined in 1962 and before the days of TTL logic, it is

no surprise that the standard does not use 5V and ground logic levels. Instead, a high level for the

driver output is defined as between +5V to +15V, and a low level for the driver output is defined

as between -5V and -15V. The receiver logic levels were defined to provide a 2V noise margin.

As such, a high level for the receiver is defined asbetween +3V to +15V, and a low level is

between -3V to -15V. Figure 1 illustrates the logic levels defined by the RS-232 standard. It is

necessary to note that, for RS-232 communication, a low level (-3V to -15V) is defined as a logic

1 and is historically referred to as "marking." Similarly, a high level (+3V to +15V) is defined as

a logic 0 and is referred to as "spacing."

Page 2: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 2/60

 

Figure 1. RS-232 logic-level specifications.

The RS-232 standard also limits the maximum slew rate at the driver output. This limitation was

included to help reduce the likelihood of crosstalk between adjacent signals. The slower the rise

and fall time, the less chance of crosstalk. With this in mind, the maximum slew rate allowed is

30V/ms. Additionally, standard defines a maximum data rate of 20kbps , again to reduce the

chance of crosstalk.The impedance of the interface between the driver and receiver has also been defined. The load

-232 standard the cable length

between the driver and receiver was specified to be 15 meters maximum. Revision "D"

(EIA/TIA-232-D) changed this part of the standard . Instead of specifying the maximum length

of cable, the standard specified a maximum capacitive load of 2500pF, clearly a more adequate

specification. The maximum cable length is determined by the capacitance per unit length of the

cable, which is provided in the cable specifications.

Table 1 summarizes the electrical specifications in the current standard.

Table 1. RS-232 Specifications

Page 3: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 3/60

 

RS232 

RS-232 (Recommended standard-232) is a standard interface approved by the Electronic

Industries Association (EIA) for connecting serial devices. In other words, RS-232 is a

longestablished standard that describes the physical interface and protocol for relatively low-speed serial data communication between computers and related devices.An industry trade

group, the Electronic Industries Association (EIA), defined it originally for teletypewriter

devices. In 1987, the EIA released a new version of the standard and changed the name to EIA-

232-D. Many people, however, still refer to the standard as RS-232C, or just RS-232.

Page 4: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 4/60

RS-232 is the interface that your computer uses to talk to and exchange data with your modem

and other serial devices. The serial ports on most computers use a subset of the RS-232C

standard.

2.4. Signal Description

TxD: - This pin carries data from the computer to the serial device

RXD: - This pin carries data from the serial device to the computer

Page 5: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 5/60

DTR signals: - DTR is used by the computer to signal that it is ready to communicate with the

serial device like modem. In other words, DTR indicates to the Dataset (i.e., the modem or

DSU/CSU) that the DTE (computer) is ON.

DSR: - Similarly to DTR, Data set ready (DSR) is an indication from the Dataset that it is ON.

DCD: - Data Carrier Detect (DCD) indicates that carrier for the transmit data is ON.

RTS: - This pin is used to request clearance to send data to a modem

CTS: - This pin is used by the serial device to acknowledge the computer's RTS Signal. In most

situations, RTS and CTS are constantly on throughout the communication session.

Clock signals (TC, RC, and XTC): - The clock signals are only used for synchronous

communications. The modem or DSU extracts the clock from the data stream and provides a

steady clock signal to the DTE. Note that the transmit and receive clock signals do not have to be

the same, or even at the same baud rate.

CD: - 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. In other words, this is

used by the modem to signal that a carrier signal has been received from a remote modem. 

RI: - RI stands for Ring Indicator. A modem toggles(keystroke) the state of this line when an

incoming call rings your phone. In other words, this is used by an auto answer modem to signal

the receipt of a telephone ring signal

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 ringing, these

two lines are rarely used.

Page 6: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 6/60

2.5. Limitations of RS-232

RS-232 has some serious shortcomings as an electrical interface.

Firstly, the interface presupposes a common ground between the DTE and DCE. This is

a reasonable assumption where a short cable connects a DTE and DCE in the same room, but

with longer lines and connections between devices that may be on different electrical busses, this

may not be true. We have seen some spectacular electrical events causes by "uncommon

grounds".

Secondly, a signal on a single line is impossible to screen effectively for noise. By

screening the entire cable one can reduce the influence of outside noise, but internally generated

noise remains a problem. As the baud rate and line length increase, the effect of capacitance

between the cables introduces serious crosstalk until a point is reached where the data itself is

unreadable.

Using low capacitance cable can reduce crosstalk. Also, as it is the higher frequencies

that are the problem, control of slew rate in the signal (i.e., making the signal more rounded,

rather than square) also decreases the crosstalk. The original specifications for RS-232 had no

specification for maximum slew rate.

Voltage levels with respect to ground represent the RS 232 signals. There is a wire for

each signal, together with the ground signal (reference for voltage levels). This interface is useful

for point-to-point communication at slow speeds. For example, port COM1 in a PC can be usedfor a mouse, port COM2 for a modem, etc. This is an example of point-to-point communication:

one port, one device. Due to the way the signals are connected, a common ground is required.

This implies limited cable length - about 30 to 60 meters maximum. (Main problems are

interference and resistance of the cable.) Shortly, RS 232 was designed for communication of 

local devices, and supports one transmitter and one receiver.

RS-232 in Modem Applications Modem applications are one of the most popular uses for the RS-232 standard. Figure 4

illustrates a typical modem application. As can be seen in the diagram, the PC is the DTE and the

modem is the DCE.Communication between each PC and its associated modem is accomplished

using the RS-232 standard.Communication between the two modems is accomplished through

Page 7: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 7/60

Page 8: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 8/60

2.1. RS232 on DB9 (9-pin D-type connector) 

There is a standardized pinout for RS-232 on a DB9 connector, as shown below

25-pin D-type connector Pin assignment

The "basic nine" signals used in modem communication are illustrated below.The functionality

of these signals is described below. Note that for the following signal descriptions, ON refers to a

high RS-232 voltage level (+5V to +15V), and OFF refers to a low RS-232 voltage level (-5V to

-15V). Keep in mind that a high RS-232 voltage level actually represents a logic 0, and that a

low RS-232 voltage level refers to a logic 1.

Transmitted Data (TD): One of two separate data signals, this signal is generated by the DTE

and received by the DCE.

Received Data (RD): The second of two separate data signals, this signals is generated by the

DCE and received by the DTE.

Request to Send (RTS): When the host system (DTE) is ready to transmit data to the peripheral

system (DCE), RTS is turned ON. In simplex and duplex systems, this condition maintains the

Page 9: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 9/60

DCE in receive mode. In half-duplex systems, this condition maintains the DCE in receive mode

and disables transmit mode. The OFF condition maintains the DCE in transmit mode. After RTS

is asserted, the DCE must assert CTS before communication can commence.

Clear to Send (CTS): CTS is used along with RTS to provide handshaking between the DTE

and the DCE. After the DCE sees an asserted RTS, it turns CTS ON when it is ready to begin

communication.

Data Set Ready (DSR): This signal is turned on by the DCE to indicate that it is connected to

the telecommunications line.

Data Carrier Detect (DCD): This signal is turned ON when the DCE is receiving a signal from

a remote DCE, which meets its suitable signal criteria. This signal remains ON as long as a

suitable carrier signal can be detected.

Data Terminal Ready (DTR): DTR indicates the readiness of the DTE. This signal is turned

ON by the DTE when it is ready to transmit or receive data from the DCE. DTR must be ON

before the DCE can assert DSR.

Ring Indicator (RI): RI, when asserted, indicates that a ringing signal is being received on the

communications channel.

The signals described above form the basis for modem communication. Perhaps the best way to

understand how these signals interact is to examine a step-by-step example of a modem

interfacing with a PC. The following steps describe a transaction in which a remote modem calls

a local modem.

1. The local Pc uses software to monitor the RI (Ring Indicate) signal.

2. When the remote modem wants to communicate with the local modem, it generates an RI

signal. This signal is transferred by the local modem to the local PC.

3. The local PC responds to the RI signal by asserting the DTR (Data Terminal Ready) signal

when it is ready to communicate.

4. After recognizing the asserted DTR signal, the modem responds by asserting DSR (Data Set

Ready) after it is connected to the communications line. DSR indicates to the PC that the modem

is ready to exchange further control signals with the DTE to commence communication. When

DSR is asserted, the PC begins monitoring DCD for an indication that data is being sent over the

communication line.

Page 10: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 10/60

5. The modem asserts DCD (Data Carrier Detect) after it has received a carrier signal from the

remote modem that meets the suitable signal criteria.

6. At this point data transfer can began. If the local modem has full-duplex capability, the CTS

(Clear to Send) and RTS (Request to Send) signals are held in the asserted state. If the modem

has only halfduplex capability, CTS and RTS provide the handshaking necessary for controlling

the direction of the data flow. Data is transferred over the RD and TD signals.

7. When the transfer of data has been completed, the PC disables the DTR signal. The modem

follows by inhibiting the DSR and DCD signals. At this point the PC and modem are in the

original state described in step number 1.

Page 12: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 12/60

 

The drivers provide RS-232 voltage level outputs (approx. ± 7.5 V) from a single + 5 V supply

via on-chip charge pumps and external capacitors. This makes it useful for implementing RS-232

in devices that otherwise do not need any voltages outside the 0 V to + 5 V range, as power

supply design does not need to be made more complicated just for driving the RS-232 in this

case.

The receivers reduce RS-232 inputs (which may be as high as ± 25 V), to standard

5 V TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of 

0.5 V.

The later MAX232A is backwards compatible with the original MAX232 but may operate at

higher baud rates and can use smaller external capacitors – 0.1 μF in place of the 1.0 μF

capacitors used with the original device.

The newer MAX3232 is also backwards compatible, but operates at a broader voltage range,

from 3 to 5.5V.

Page 13: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 13/60

Voltage levels:

It is helpful to understand what occurs to the voltage levels. When a MAX232 IC receives a TTL

level to convert, it changes a TTL Logic 0 to between +3 and +15V, and changes TTL Logic 1 to

between -3 to -15V, and vice versa for converting from RS232 to TTL. This can be confusing

when you realize that the RS232 Data Transmission voltages at a certain logic state are opposite

from the RS232 Control Line voltages at the same logic state. To clarify the matter, see the table

below. For more information see RS-232 Voltage Levels. 

RS232 Line Type & Logic LevelRS232

Voltage

TTL Voltage to/from

MAX232

Data Transmission (Rx/Tx) Logic 0 +3V to +15V 0V

Data Transmission (Rx/Tx) Logic 1 -3V to -15V 5V

Control Signals (RTS/CTS/DTR/DSR) Logic

0-3V to -15V 5V

Control Signals (RTS/CTS/DTR/DSR) Logic

1+3V to +15V 0V

Page 14: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 14/60

Serial Communication

General Description:

There are 2 ways to transfer the data in computer world one is serial and another one is

parallel communication. In parallel communication transfer the data with 2 or more lines.

Parallel communication is used to data transfer to the devices few feet away and it is fast. In

Serial communication the data is sent one bit at a time. Data can be transfer to longer distances

with minimum number of wires efficiently. It is economical and error free compare to parallel

communication. To establish serial communication we need a RS232 Serial connector, MAX232

(to match voltage levels of 2 devices) and a serial cable

Hardware Explanation:

RS-232C: 

RS-232 (ANSI/EIA-232 Standard) is a standard serial protocol used to establish a

communication between the two same or different processors. RS232 is developed to

support different voltage levels of devices in the range of 

+3V to +25V for logic 0

-3V to -25V for logic 1

RS-232 hardware can be used for serial communication up to distances of 12 feet.

RS232 or DB-9 pin connector: 

1 2 3 4 5

6 7 8 9

Page 15: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 15/60

 

Pin Functions:

Data: TX on pin 3, RX on pin 2

Handshake: RTS on pin 7, CTS on pin 8, DSR on pin 6,

CD on pin 1, DTR on pin 4

Common: Common pin 5(ground)

Other: RI on pin 9

The method used by RS-232 for communication allows for a simple connection of 

three lines: TX, RX, and Ground. The three essential signals for 2 way RS-232 Communications

are these:

TXD: carries data from DTE to the DCE.

RXD: carries data from DCE to the DTE

MAX232:

Max232 is used to convert the TTL voltage levels of microcontroller (logic0-0v, logic1 – 

5v) into voltage levels of RS232 standards (logic0 - +3 to +25v, logic1 - – 3 to -25v). MAX232 is

a dc-to-dc converter, which takes TTL levels as input and produces RS232 levels, which are

required for DTE to DTE communication. RS-232 communication is asynchronous. 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.

The RS232 levels are generated internally using switching latches and capacitors of 10uf each.

Page 16: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 16/60

Serial Communication to a PC or Mac

The RS-232 serial ports on Windows- based PC’s looks like this: 

PC serial cable (facing the soldering lugs of a female connector)

The connections for this are the same as the connector used to program the BX- 24, and to

debug from both the PIC and the BX-24, so you can use the same connector, or make a second

one just like it. From there, you will need a 9-pin serial cable. Use any serial port you want, but

be sure that all other programs that might be trying to use the serial port are turned off.

RS-232C

RS-232 stands for Recommend Standard number 232 and C is the latest revision of the standard.

The serial ports on most computers use a subset of the RS-232C standard. The full RS-232C

standard specifies a 25-pin "D" connector of which 22 pins are used. Most of these pins are not

needed for normal PC communications, and indeed, most new PCs are equipped with male D

type connectors having only 9pins.

DCE and DTE Devices 

Two terms you should be familiar with are DTE and DCE. DTE stands for Data Terminal

Equipment, and DCE stands for Data Communications Equipment. These terms are used to

indicate the pin-out for the connectors on a device and the direction of the signals on the pins.

Page 17: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 17/60

Your computer is a DTE device, while most other devices are usually DCE devices.

If you have trouble keeping the two straight then replace the term "DTE device" with "your PC"

and the term "DCE device" with "remote device" in the following discussion.

The RS-232 standard states that DTE devices use a 25-pin male connector, and DCE devices use

a 25-pin female connector. You can therefore connect a DTE device to a DCE using a straight

pin-for-pin connection. However, to connect two like devices, you must instead use a null

modem cable. Null modem cables cross the transmit and receive lines in the cable, and are

discussed later in this chapter. The listing below shows the connections and signal directions for

both 25 and 9-pin connectors.

9 Pin Connector on a DTE device (PC connection) 

Male RS232

DB9

Pin Number  Direction of signal: 

1 Carrier Detect (CD) (from DCE) Incoming signal from a modem

2 Received Data (RD) Incoming Data from a DCE

3 Transmitted Data (TD) Outgoing Data to a DCE

4 Data Terminal Ready (DTR) Outgoing handshaking signal

5 Signal Ground Common reference voltage

6 Data Set Ready (DSR) Incoming handshaking signal

7 Request to send (RTS) outgoing flow control signal

8 Clear to send (CTS) incoming flow control signal

9 Ring indicator (RI) incoming signal from a modem

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

Page 18: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 18/60

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

Page 19: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 19/60

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 ringing, these

two lines are rarely used.

Cables Lengths

The RS-232C standard imposes a cable length limit of 50 feet. You can usually ignore this

"standard", since a cable can be as long as 10000 feet at baud rates up to 19200 if you use a high

quality, well shielded cable. The external environment has a large effect on lengths for

unshielded cables. In electrically noisy environments, even very short cables can pick up stray

signals. The following chart offers some reasonable guidelines for 24 gauge wire under typical

conditions. You can greatly extend the cable length by using additional devices like optical

isolators and signal boosters. Optical isolators use LEDs and Photo Diodes to isolate each line in

a serial cable including the signal ground. Any electrical noise affects all lines in the optically

isolated cable equally - including the signal ground line. This causes the voltages on the signal

lines relative to the signal ground line to reflect the true voltage of the signal and thus cancelingout the effect of any noise signals.

Baud Rate  ShieldedCable Length  UnshieldedCable Length 

110 5000 1000

300 4000 1000

1200 3000 500

2400 2000 500

4800 500 250

9600 250 100

Synchronous and Asynchronous Communications

Page 20: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 20/60

There are two basic types of serial communications, synchronous and asynchronous. With

synchronous communications, the two devices initially synchronize themselves to each other,

and then continually send characters to stay in sync. Even when data is not really being sent, a

constant flow of bits allows each device to know where the other is at any given time. That is,

each character that is sent is either actual data or an idle character. Synchronous communications

allows faster data transfer rates than asynchronous methods, because additional bits to mark the

beginning and end of each data byte are not required. The serial ports on IBM-style PCs are

asynchronous devices and therefore only support asynchronous serial communications.

Asynchronous means "no synchronization", and thus does not require sending and receiving idle

characters. However, the beginning and end of each byte of data must be identified by start and

stop bits. The start bit indicates when the data byte is about to begin and the stop bit signals when

it ends. The requirement to send these additional two bits causes asynchronous communication to

be slightly slower than synchronous however it has the advantage that the processor does not

have to deal with the additional idle characters.

An asynchronous line that is idle is identified with a value of 1 (also called a mark state). By

using this value to indicate that no data is currently being sent, the devices are able to distinguish

between an idle state and a disconnected line. When a character is about to be transmitted, a start

bit is sent. A start bit has a value of 0 (also called a space state). Thus, when the line switches

from a value of 1 to a value of 0, the receiver is alerted that a data character is about to be sent.

HD12D (DECODER)

FEATURES

Page 21: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 21/60

  18 PIN DIP

  Operating voltage 2.4V ~ 12V

  Low power and high noise immunity CMOS technology

  Low standby current

  Capable of decoding 12 bits of information

  Binarry address setting

  Receviied codes are checked 3 times

  Address/Data number combination is 8 address bits and 4 data bits

  Built in oscillator needs only 5% resistor

  Valid transmission indicator

  Easy interface with an RF or an infrared transmission medium

  Minimal external components

  Pair with 212

series of encoders

Applications:

  Burglar alarm, smoke alarm, fire alarm, car alarm, security system

  Garage door and car door controllers

  Cordless telephone

General Description:

The 212

decoders are a series of CMOS LSIs for remote control system applications. They

are paired with 212

series of encoder. For proper operation, a pair of encoder/decoder with the

same number of address and data format should be chosen.

The decoders receive serial address and data from a programmed 212 series of encoders

that are transmitted by a carrier using an RF or an IR transmission medium. They compare the

serial input data three times continuously with their local addresses. If no error or unmatched

codes are found, the input data codes are decoded and then transferred to the output pins. The VT

pin also goes high to indicate a valid transmission.

Page 22: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 22/60

The 212 series of decoders are capable of decoding information that consists of N bits of 

address and 12-N bits of data. Of this series, the HT12D is arranged to provide 8 address bits and

4 data bits.

Block Diagram:

Pin Diagram:

Page 23: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 23/60

 

Pin Description: 

A0 - A7: These are the input pins for address A0-A7 setting. These pins can be externally set to

Vss or left open.

D8 – D11: these are the output data pins, power on state is low.

Din: it is a serial data input pin.

VT: Valid transmission, active high pin.

OSC1: oscillator input pin

Osc2: oscillator output pin

Vss: Groung pin

Vdd: Power supply

Absolute Maximum Ratings:

Page 24: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 24/60

Supply voltage…….. -0.3V to 13V

Input voltage………. Vss -0.3V to Vdd +0.3V

Storage Temperature……. -500C to 125

0C

Functional Description:

Operation:

The 212

series of decoders provides various combinations of addresses and data pins in

different packages so as to pair with the 212

series of encoders.

The decoders recevie data that are transmitted by an encoder and inerpret the first N bits

of code period as addresses and the last 12-N bits as data, where N is the address code number. A

signal on the DIN pin actives the oscillator which in turn decodes the incoming address and data.

The decoders will then check the recevied address three times continuously. If the recevied

address codes all match the contents of the decoders local address, the 12-N bits of data are

decoded to activate the output pins and the VT pin is set high to indicate a valid transmission.

This will last unless the address code is incorrect or no signal is recevied.

The output of the VT pin is high only when the transmission is valid. Otherwise it is always low.

Output type: 

Of the 212

series of decoders, the HT12F has no data output pin but its VT pin can be

used as a momentary data output. The HT12D, on the other hand, provides 4 latch type data pins

whose dat remain unchanged until new data are recevied.

Part No. Data pins Address pins Output Operating

Page 25: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 25/60

Type Voltage

HT12D 4 8 Latch 2.4V~12V

HT12F 0 12 --- 2.4V~12V

Flowchart:

The oscillator is disabled in the standby state and activated when a logic “high” signal

applies to the DIN pin. That is to say, the DIN should be kept low if there is no signal input.

Page 26: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 26/60

 

Page 27: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 27/60

Decoder Timing:

Page 28: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 28/60

HD12E (ENCODER)

Features:

  18 pin DIP

  Operating voltage is 2.4V ~ 12V

  Low power and high noise immunity CMOS technology

  Low standby current: 0.1µA (typ.) at VDD = 5V

  Minimum transmission four words for the HT12E

  Built in oscillator needs only 5% resistor

  Data code has positive polarity

  Minimal external components

Applications:

  Burglar alarm, smoke alarm, fire alarm, car alarm, security system

  Garage door and car door controllers

  Cordless telephone

General Description:

The 212

encoders are a series of CMOS LSIs for remote control syatem applications.

They are capable of encoding information which consists of N address bits and 12-N data bits.

Each address / data input can be set to one of the two logic states. The programmed

addresses/data are transmitted together with the header bits via an RF or an infrared transmission

medium upon receipt of a trigger signal. The capability to select a TE trigger on the HT12E or a

DATA trigger on the HT12A further enhances the application flexibility of the 2 12 series of 

encoders. The HT12A additionally provides a 38kHz carrier for infrared systems.

Page 29: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 29/60

 

Block Diagram:

Pin Diagram:

HT12E

Page 30: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 30/60

 

Pin Description:

A0-A7: These are the input pins for address A0  – A7. These pins can be externally set to Vss or

left open.

Dout: This pin is encoder data serial trasmission out pin.

TE: It’s a transmission enable pin and it’s a active low pin. 

OSC1: Oscillator input pin.

OSC2: Oscillator output pin.

Vss: Ground pin.

Vdd: Power supply pin.

Absolute Maximum Ratings:

Supply voltage…………………-0.3V to 13V

Inputvoltage……………………Vss -0.3V t Vdd +03V

Storage aTemperature….. -500C to 125

0C

Operating Temperature….. -200C to 75

0C

Functional Description: 

Operation:

The 212 series of encoders begin a 4 word transmission cycle upon receipt of a

transmission enable. This cycle will repeatitself as long as the transmission enble is held low.

Once the transmission enable returns high the encoder output completes its final cycle and then

stops as shown below.

Page 31: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 31/60

4

Address/Data waveform:

Each programmable address/data pin can be externally set to one the following two logic states

as shown below.

Address/data programming (preset):

The status of each address/data pin can be individually pre-set to logic “high” or “low”. If 

a transmssion enable signal is applied, the encoder scans and transmits the status of the 12 bits of address/data serially in the order A0 to AD11 for the HT12E encoder.

During information transmission these bits are transmitted with a preceding

synchronization bit. If the trigger signal is not applied, the chip enters the standby mode and

consumes a reduced current of less than 1µA for a supply voltage of 5V.

Usual information preset the address pins with individual security codes using DIP

switches or PCB wiring, while the data is selected by push buttons or electronic switches.

Address/Data sequence:

The following provides the address/data sequence table for various models of the 212

series of encoders. The correct device should be selewcted according to the individual address

and data requirements.

Page 32: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 32/60

 

HT12E

Address/Data Bits

0 1 2 3 4 5 6 7 8 9 10 11

A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11

Transmission Enable: 

For the HT12E encoders, transmission is enabled by aplying a low signal to the TE pin.

Flowchart:

Page 33: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 33/60

KEIL SOFTWARE TOOL (STEPS)

1.  Click on the Keil uVision Icon on DeskTop

2.  The following fig will appear

3.  Click on the Project menu from the title bar

4.  Then Click on New Project

Page 34: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 34/60

 

5.  Save the Project by typing suitable project name with no extension in u r own folder

sited in either C:\ or D:\ 

Page 35: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 35/60

6.  Then Click on Save button above.

7.  Select the component for u r project. i.e. Atmel…… 

8.  Click on the + Symbol beside of Atmel

9.  Select AT89C52 as shown below

Page 36: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 36/60

 

10.  Then Click on “OK” 

11.  The Following fig will appear

Page 37: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 37/60

12.  Then Click either YES or NO………mostly “NO” 

13.  Now your project is ready to USE

14.   Now double click on the Target1, you would get another option “Source group 1” as

shown in next page.

15.  Click on the file option from menu bar and select “new” 

Page 38: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 38/60

 

16.  The next screen will be as shown in next page, and just maximize it by double

clicking on its blue boarder.

17.   Now start writing program in either in “C” or “ASM” 

Page 39: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 39/60

18.  For a program written in Assembly, then save it with extension “. asm” and for “C”

based program save it with extension “ .C” 

19.   Now right click on Source group 1 and click on “Add files to Group Source” 

Page 40: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 40/60

 

20.   Now you will get another window, on which by default “C” files will appear. 

21.  Now select as per your file extension given while saving the file

22.  Click only one time on option “ADD” 

23.  Now Press function key F7 to compile. Any error will appear if so happen.

Page 41: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 41/60

 

24.  If the file contains no error, then press Control+F5 simultaneously.

25.  The new window is as follows

26.  Then Click “OK” 

27.  Now Click on the Peripherals from menu bar, and check your required port as shown

in fig below

Page 42: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 42/60

 

28.  Drag the port a side and click in the program file.

29.   Now keep Pressing function key “F11” slowly and observe. 

30.  You are running your program successfully

Page 43: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 43/60

Keypad connector

In this product we have to design the 8 keys keypad directly connecting the 8 keys into

8 pins of Micro Controller. In this board we have to adding the extra feature like Matrix Keypad.

In this 8 pins of AT89C51 are connected to the Keypad Connector. Matrix keypads such 4 by 4

can be connected directly to the connector. 5 Volt and Ground power lines are also available on

the connector.

These two types of features are only working with any one external interrupt because of every

key pressing its generating the interrupt.

Block diagram:

Embedded

Controller

(U12)

KEYPAD

DATA

Interrupt

VCC

GND

Page 44: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 44/60

Hardware Connections:

CONTROLER

PINS

KEYPAD PIN NAME FEATURE

P0.7 TO P0.2 &

P0.1,P0.0

SW1 TO SW6 &

8,9

DATA DATA

P3.3(INT1) interrupt CLK Interrupt

20 GND

40 VCC

Page 45: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 45/60

 

MAX 232 ---- DUAL DRIVER/RECIEVER 

FEATURES:

  Operates from a single 5V Power Supply with 1.0uF Charge-Pump Capacitors

  Operates up to 120 k bit/s

  Two Drivers and Two Receivers

  ±30 V Input Levels

  Low Supply Current . . . 8 mA Typical

Upgrade with Improved ESD (15kV HBM) and 0.1uF Charge-Pump Capacitors is available

With the MAX202.

Applications-- TIA/EIA-232-F, Battery-Powered Systems, Terminals, Modems, and Computers

DESCRIPTION:

The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to

supply TIA/EIA-232-F voltage levels from a single 5V supply. Each receiver converts TIA/EIA-

232-F inputs to 5V TTL/CMOS levels. These receivers have a typical threshold of 1.3V, a

typical hysteresis of 0.5 V, and can accept up to 30V inputs. Each driver converts TTL/CMOS

input levels into TIA/EIA-232-F levels.

Page 46: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 46/60

PIN DIAGRAM OF MAX232

FUNCTION TABLE

Page 47: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 47/60

LOGIC DIAGRAM

(POSITIVE LOGIC)

RECOMMENDED OPERATING CONDITIONS

PARAMETER MIN NOR

MAX

UNIT

VCC Supply voltage  4.5 5 5.5  V

VIH High-level input

voltage

(T1IN,T2IN) 

2 V

Page 48: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 48/60

 

VIL Low-level input voltage

(T1IN, T2IN) 

0.8 V

R1IN, R2IN Receiver input

voltage 

V

TA Operating free-air

temperature

0

70

Page 49: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 49/60

POWER SUPPLY:

In this project we have power supplies with +5V & -5V option normally +5V is

enough for total circuit. Another (-5V) supply is used in case of OP amp circuit

.Transformer primary side has 230/50HZ AC voltage whereas at the secondary winding

the voltage is step downed to 12/50hz and this voltage is rectified using two full wave

rectifiers .the rectified output is given to a filter circuit to fiter the unwanted ac in the

signal After that the output is again applied to a regulator LM7805(to provide +5v)

regulator. Whereas LM7905 is for providing  – 5V regulation.

(+12V circuit is used for stepper motors, Fan and Relay by using LM7812 regulator same

process like above supplies.)

HEAT SINK:

More often transistors gets heated when the circuit is ON for long time. In

order to avoid heating up of transistors we use heat sinks.

BLOCK DIAGRAM OF POWER SUPPLY

DFD is the power supply pin for the circuit. A step down transformer is used to

convert 230V 50HZ line voltage 12-0-12V ac input to the supply pin of the circuit. The ac

voltage is converted to pulsated dc using a center tapped full wave rectifier. Any ripples if 

present are eliminated using a capacitive filter at the output of the full wave rectifier. The

capacitive filter output is input to 7805-voltage regulator, which produces a dc equivalent

of ac 5V. This 5V dc acts as VCC to the micro controller. The excess voltage is dissipated as

heat via an Aluminum heat sink attached to the voltage regulator.

Page 50: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 50/60

Page 51: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 51/60

Page 52: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 52/60

Vm of the rectifier voltage. Now the rectifier voltage starts to decrease. As this occurs the

capacitor discharges through the load and the voltage across it decrease. The voltage across

load will decrease only slightly because immediately the next voltage peak comes and

recharges the capacitor. This process is repeated again and again. At the output very little

ripple is left. moreover output voltage is higher as it remains substantially near the peak

value of rectifier output voltage.

The capacitor filter circuit is extremely popular because of its low cost, small size,little

weight and good characteristics. For small load currents this type of filter is preferred. it is

commonly used in transistor radio battery eliminators.

RL

Capacitor Filter

CRectifier O/P

Page 53: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 53/60

POWER SUPPLY:

Description:

A variable regulated power supply, also called a variable bench power supply, is one where

you can continuously adjust the output voltage to your requirements. Varying the output of 

the power supply is the recommended way to test a project after having double checked

parts placement against circuit drawings and the parts placement guide.

This type of regulation is ideal for having a simple variable bench power supply. Actually

this is quite important because one of the first projects a hobbyist should undertake is the

construction of a variable regulated power supply.

While a dedicated supply is quite handy e.g. 5V or 12V, it's much handier to have a

variable supply on hand, especially for testing.

Most digital logic circuits and processors need a 5 volt power supply. To use these parts we

need to build a regulated 5 volt source. Usually you start with an unregulated power supply

ranging from 9 volts to 24 volts DC To make a 5 volt power supply, we use a LM7805

voltage regulator IC (Integrated Circuit). The IC is shown below.

Fig: 5.2.1

Page 54: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 54/60

 

The LM7805 is simple to use. You simply connect the positive lead of your unregulated DC

power supply (anything from 9VDC to 24VDC) to the Input pin, connect the negative lead

to the common pin and then when you turn on the power, you get a 5 volt supply from the

Output pin.

Block Diagram:

Circuit Features: 

Brief description of operation: Gives out well regulated +5V output, output current

capability of 100 mA

Circuit protection: Built-in overheating protection shuts down output when regulator IC

gets too hot

Page 55: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 55/60

Circuit complexity: Very simple and easy to build Circuit performance: Very stable +5V

output voltage, reliable operation Availability of components: Easy to get, uses only very

common basic components

Design testing: Based on datasheet example circuit, I have used this circuit successfully as

part of many electronics projects

Applications: Part of electronics devices, small laboratory power supply

Power supply voltage: Unregulated DC 8-18V power supply

Power supply current: Needed output current + 5 mA

Component costs: Few dollars for the electronics components + the input transformer cost.

Page 56: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 56/60

RF COMMUNICATION:

RF communication stands for Radio Frequency communication in which communication is

purely based on radio frequency(3khz to 300ghz).we can send and receive data using Radio

frequency.

  RF section consists of two units i.e.,

  TRANSMITTER UNIT

  RECEIVER UNIT

  TRANSMITTER UNIT: In this unit we have RF transmitter with antenna

connected to encoder inorder to encode the digital data which is to be transmitted in

the form of radio waves.

  RECEIVER UNIT : In this unit we have RF receiver with antenna connected to

decoder inorder to decode the digital data which is transmitted by the transmitter

unit is received by this unit using radio waves

Every system is automated in order to face new challenges in the present day situation.

Automated systems have less manual operations, so that the flexibility, reliabilities are high and

accurate. Hence every field prefers automated control systems. Especially in the field of 

electronics automated systems are doing better performance. Any automated system will work 

effectively if it access wirelessly. Here in this project we are going to use RF communication for

remote accessing of automated system. Probably the most useful thing to know about the RF

communication is that it is an international standard communication.

RF communication works by creating electromagnetic waves at a source and being able to pick 

up those electromagnetic waves at a particular destination. These electromagnetic waves travel

through the air at near the speed of light. The wavelength of an electromagnetic signal is

inversely proportional to the frequency; the higher the frequency, the shorter the wavelength.

Page 57: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 57/60

RF TRANSMITTER/RECEIVER:

RF Link Transmitter - 434MHz

sku: WRL-08946

RF transmitter performs modulation, up conversion, and power amplification with the first two

functions combined in same cases. Transmitter design required a solid understanding of 

modulation schemes because of their influence on the choice of such building blocks as up-

conversion mixers oscillators and power amplifiers (PAs).

Description: This is only the 434MHz transmitter. This will work with the RF Links at 434MHz

at either baud rate. Only one 434MHz transmitter will work within the same location. This

wireless data is the easiest to use, lowest cost RF link we have ever seen! Use these components

to transmit position data, temperature data, even current program register values wirelessly to the

receiver. These modules have up to 500 ft range in open space. The transmitter operates from 2-

12V. The higher the Voltage, the greater the range - see range test data in the documents section.

We have used these modules extensively and have been very impressed with their ease of use

and direct interface to an MCU. The theory of operation is very simple. What the transmitter

'sees' on its data pin is what the receiver outputs on its data pin. If you can configure the UART

module on a PIC, you have an instant wireless data connection. The typical range is 500ft for

open area.

This is an ASK transmitter module with an output of up to 8mW depending on power supply

voltage. The transmitter is based on SAW resonator and accepts digital inputs, can operate from

2 to 12 Volts-DC, and makes building RF enabled products very easy.

Page 58: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 58/60

 

Figure: 11: RF Transmitter

RF Link 4800bps Receiver - 434MHz

sku: WRL-08950

Description: Sold as a receiver only. This receiver type is good for data rates up to 4800bps and

will only work with the 434MHz transmitter. Multiple 434MHz receivers can listen to one

434MHz transmitter.

This wireless data is the easiest to use, lowest cost RF link we have ever seen! Use these

components to transmit position data, temperature data, even current program register values

wirelessly to the receiver. These modules have up to 500 ft range in open space. The receiver is

operated at 5V.

We have used these modules extensively and have been very impressed with their ease of use

and direct interface to an MCU. The theory of operation is very simple. What the transmitter

'sees' on its data pin is what the receiver outputs on its data pin. If you can configure the UART

Page 59: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 59/60

module on a PIC, you have an instant wireless data connection. Data rates are limited to

4800bps. The typical range is 500ft for open area.

This receiver has a sensitivity of 3uV. It operates from 4.5 to 5.5 volts-DC and has digital output.

The typical sensitivity is -103dbm and the typical current consumption is 3.5mA for 5V

operation voltage.

Features: 

  434 MHz Operation

  500 Ft. Range - Dependent on Transmitter Power Supply

  4800 bps transfer rate

  Low cost

  Extremely small and light weight

Page 60: Lash Sheshi

8/2/2019 Lash Sheshi

http://slidepdf.com/reader/full/lash-sheshi 60/60