You are on page 1of 7

Introduction To RS232 Serial Communication Serial communication is basically the transmission or reception of data one bit at a time.

Today's computers generally address data in bytes or some multiple thereof. A byte contains 8 bits. A bit is basically either a logical 1 or zero. Every character on this page is actually expressed internally as one byte. The serial port is used to convert each byte to a stream of ones and zeroes as Universal Asynchronous Receiver!Transmitter "#A$T% that actually does the conversion. The serial port has many pins. &e spea'ing( ill discuss the transmit and receive pin first. Electrically ell as to convert a streams of ones and zeroes to bytes. The serial port contains a electronic chip called a

henever the serial port sends a logical one "1% a negative voltage is effected on the

transmit pin. &henever the serial port sends a logical zero ")% a positive voltage is effected. &hen no data is being sent( the serial port's transmit pin's voltage is negative "1% and is said to be in a MARK state. *ote that the serial port can also be forced to 'eep the transmit pin at a positive voltage ")% and is said to be the SPACE or BREAK state. "The terms MARK and SPACE are also used to simply denote a negative voltage "1% or a positive voltage")% at the transmit pin respectively%. &hen transmitting a byte( the #A$T "serial port% first sends a START BIT t o STOP BITs hich is a positive

voltage ")%( follo ed by the data "general 8 bits( but could be +( ,( -( or 8 bits% follo ed by one or hich is a negative"1% voltage. The se.uence is repeated for each byte sent. Figure 1 sho s a diagram of a hat a byte transmission ould loo' li'e.

Figure 1 At this point you may ant to 'no hat is the duration of a bit. /n other ords( ho long does the signal stay in a particular state to define a bit. The ans er is simple. /t is dependent on the baud rate. The baud rate is the number of times the signal can s itch states in one second. Therefore( if the line is operating at 0,)) baud( the line can s itch states 0(,)) times per second. This means

each

bit

has

the

duration

of

1!0,))

of

second

or

about

1))

1sec.

&hen transmitting a character there are other characteristics other than the baud rate that must be 'no n or that must be setup. These characteristics define the entire interpretation of the data stream. The first characteristic is the length of the byte that be any here from + to 8 bits. The second characteristic is parity. The parity characteristic can be even( odd( mar'( space( or none. /f even parity( then the last data bit transmitted ill be a logical 1 if the data transmitted had ill be a logical 1 if the ill al ays be a an even amount of ) bits. /f odd parity( then the last data bit transmitted ill be transmitted. This length in general can

data transmitted had an odd amount of ) bits. /f MARK parity( then the last transmitted data bit ill al ays be a logical 1. /f SPACE parity( then the last transmitted data bit logical ). /f no parity then there is no parity bit transmitted. The third characteristic is the amount of stop bits. This value in general is 1 or 2. Assume e ant to send the letter 'A' over the serial port. The binary representation of the letter 'A' is )1)))))1. $emembering that bits are transmitted from least significant bit "3S4% to most significant bit "5S4%( the bit stream transmitted bits( no parity( 1 stop bit( 0,)) baud. SB !" 1 " " " " " 1 " 1# MSB The above represents "Start 4it% "6ata 4its% "Stop 4it% To calculate the actual byte transfer rate simply divide the baud rate by the number of bits that must be transferred for each byte of data. /n the case of the above example( each character re.uires 1) bits to be transmitted for each character. As such( at 0,)) baud( up to 0,) bytes can be transferred in one second. ould be as follo s for the line characteristics 8

The above discussion as concerned

ith the 7electrical!logical7 characteristics of the data stream.

&e ill expand the discussion to line protocol. Serial communication can be half duplex or full duplex. 8ull duplex communication means that a device can receive and transmit data at the same time. 9alf duplex means that the device cannot send and receive at the same time. /t can do them both( but not at the same time. 9alf duplex communication is all but outdated except for a very small focused set of applications. 9alf duplex serial communication needs at a minimum t o ires( signal ground and the data line. ires( signal ground( transmit data

8ull duplex serial communication needs at a minimum three

line( and receive data line. The $S2:2 specification governs the physical and electrical characteristics of serial communications. This specification defines several additional signals that are asserted "set to logical 1% for information and control beyond the data signals and signal ground. These signals are the ;arrier 6etect Signal ";6%( asserted by modems to signal a successful connection to another modem( $ing /ndicator "$/%( asserted by modems to signal the phone ringing( 6ata Set $eady "6S$%( asserted by modems to sho their presence( ;lear To Send ";TS%( asserted by modems if they can receive data( 6ata Terminal $eady "6T$%( asserted by terminals to sho their presence( $e.uest To Send "$TS%( asserted by terminals if they can receive data. The section $S2:2 ;abling describes these signals and ho they are connected. The above paragraph eluded to hard are flo control. 9ard are flo control is a method that t o connected devices use to tell each other electronically modem in general drops "logical )% its ;TS line asserts it Another method of hard are flo hen to send or hen not to send data. A ith the $TS signal. hen it can no longer receive characters. /t re<

hen it can receive again. A terminal does the same thing instead

control in practice is to perform the same procedure in the

previous paragraph except that the 6S$ and 6T$ signals are used for the handsha'e.

*ote that hard are flo control re.uires the use of additional crisp and reliable flo control. Another method of flo control. This method re.uires a simple :

ires. The benefit to this ho ever is

control used is 'no n as soft are flo ill transmit

ire serial communication lin'( transmit data( receive hen a device can no longer receive( it

data( and signal ground. /f using this method(

a character that the t o devices agreed on. This character is 'no n as the =>88 character. This character is generally a hexadecimal 1:. &hen a device can receive again it transmits an =>* character that both devices agreed to. This character is generally a hexadecimal 11.

$U

MO%EM& A$ I$TRO%UCTIO$ ith $S2:2. >ne of the oldest and most orld. The idely spread communication ell the use of %TE!%CE here %CE is the ith

Serial communications methods in computer communication( the

ay this type of communication can be performed is pretty

defined in standards. /.e.

ith one exception. The standards sho

ay a computer should communicate

ith a peripheral device li'e a modem.

8or your information( %TE means data terminal equipment "computers etc.% communication today

abbreviation of data communication equipment "modems%. >ne of the main uses of serial here no modem is involved?a serial null modem configuration ell defined( especially hen it comes to flo %TE!%TE communication?is not so control. The

terminology null modem for the situation

here t o computers communicate directly is so often

used no adays( that most people don't realize anymore the origin of the phrase and that a null modem connection is an exception( not the rule. /n history( practical solutions ere developed to let t o computers tal' ith each other using a null modem serial communication line. /n most situations( the original modem signal lines are reused to perform some sort of handsha'ing. 9andsha'ing can increase the maximum allo ed communication speed because it gives the computers the ability to control the flo busy performing other tas's. /f no flo of information. 9igh amounts of incomming data is allo ed if the computer is capable to handle it( but not if it is control is implemented in the null modem connection( hich it is sure the receiving side can handle the communication is only possible at speeds at

amount information even under orst case conditions.

Original u'e o( RS232 &hen e loo' at the connector pinout of the $S2:2 port( e see t o pins hich are certainly used for flo control. These t o pins are RTS( re.uest to send and CTS( clear to send. &ith %TE!%CE communication "i.e. a computer communicating ith a modem device% RTS is an output on the %TE and input on the %CE. CTS is the ans ering signal comming from the %CE. 4efore sending a character( the %TE as's permission by setting its RTS output. *o information ill be sent until the %CE grants permission by using the CTS line. /f the %CE cannot handle ne re.uests( the CTS signal ill go lo . A simple but useful mechanism allo ing flo control in one direction. The assumption is( that the %TE can al ays handle incomming information faster than the %CE can send it. /n the past( this as true. 5odem speeds of :)) baud ere common and 12)) baud as seen as a high speed connection. 8or further control of the information flo ( both devices have the ability to signal their status to the other side. 8or this purpose( the %TR data terminal ready and %SR data set ready signals are present. The %TE uses the %TR signal to signal that it is ready to accept information( of re.uesting and ans ering as only. The last flo control signal present in %TE!%CE communication is the C% carrier detect. /t is not used directly for flo communicate control( but mainly an indication of the ability of the modem device to ith its counter part. This signal indicates the existence of a communication lin' hereas the %CE uses the %SR signal for the same purpose. #sing these signals involves not a small protocol ith the RTS!CTS handsha'ing. These signals are in one direction

bet een t o modem devices. $ull modem )it*out *and'*a+ing 9o to use the handsha'ing lines in a null modem configuration@ The simplest ay is to don't use

them at all. /n that situation( only the data lines and signal ground are cross connected in the null

modem communication cable. All other pins have no connection. An example of such a null modem cable ithout handsha'ing can be seen in the figure belo . Sim,le null modem )it*out *and'*a+ing

Connector 1 Connector 2 2 : + : 2 +

Function $x Tx Tx $x

Signal ground

Com,ati-ilit. i''ue' /f you read about null modems( this three ire null modem cable is often tal'ed about. Aes( it is simple but can e use it in all circumstances@ There is a problem( if either of the t o devices chec's the %SR or C% inputs. These signals normaly define the ability of the other side to communicate. As they are not connected( their signal level ill never go high. This might cause a problem. The same holds for the RTS!CTS handsha'ing se.uence. /f the soft are on both sides is structured( the RTS output is set high and then a ell aiting cycle is started until a ready signal is

received on the CTS line. This causes the soft are to hang because no physical connection is present to either CTS line to ma'e this possible. The only type of communication hich is allo ed on such a null modem line is data<only traffic on the cross connected R/!T/ lines. This does ho ever not mean( that this null modem cable is useless. ;ommunication lin's li'e present in the *orton ;ommander program can use this null modem cable. This null modem cable can also be used hen communicating electronic measuring e.uipment etc. ith devices hich do not have modem control signals li'e

As you can imagine( ith this simple null modem cable no hard are flo control can be implemented. The only ay to perform flo control is ith soft are flo control using the 0OFF and 0O$ characters.

You might also like