why is it important to learn about this standard???
The era of manually implementing logics by transistors and diodes is outdated,in this advanced digital world every logic can be simply achieved by writing a software program which can configure a target hardware (Micro controller or Micro processor) which behaves in accordance with the logic desired.
For this to carry,out we need to write a software program in a computer and use a proper compiler and assembler to convert High level software program(c,c++), in to a machine language known to the external hard ware.
So it is mandatory to interface or communicate computer with our hardwares like micro controllers or microprocessors, For this reason it is very much needed that we understand the communication standards,some of them are RS-232,USB etc which most pc'c now a days have.
Almost nothing in computer interfacing is more confusing than selecting the right RS232 serial cable. These pages are intended to provide information about the most common serial RS232 cables in normal computer use, or in more common language "How do I connect devices and computers using RS232?"
Now we shall discuss about RS-232.
"There are two versions of RS-232,they are:
1.RS-232 DB25(uses 25 pins)
Cannon 25 | |||
Pin | Name | Direction | Description |
1 | SHIELD | --- | Shield Ground |
2 | TXD | --> | Transmit Data |
3 | RXD | <-- | Receive Data |
4 | RTS | --> | Request to Send |
5 | CTS | <-- | Clear to Send |
6 | DSR | <-- | Data Set Ready |
7 | GND | --- | System Ground |
8 | CD | <-- | Carrier Detect |
9-19 | N/C | - | - |
20 | DTR | --> | Data Terminal Ready |
21 | N/C | - | - |
22 | RI | <-- | Ring Indicator |
23-25 | N/C | - | - |
Cannon 9 | |||
Pin | Name | Direction | Description |
1 | CD | <-- | Carrier Detect |
2 | RXD | <-- | Receive Data |
3 | TXD | --> | Transmit Data |
4 | DTR | --> | Data Terminal Ready |
5 | GND | --- | System Ground |
6 | DSR | <-- | Data Set Ready |
7 | RTS | --> | Request to Send |
8 | CTS | <-- | Clear to Send |
9 | RI | <-- | Ring Indicator |
Note: Clock line - for asynchronous communication is internal only
This byte is sent assynchronously. This means that receiver doesn’t know when transmitter will start sending data. But anyway there is some means needed to inform about the start of transmission. For this is START bit used at the beginning of the transmitted data. Falling edge of START bit (from logical High to Low) informs receiver about start of transmission. After receiver detected the start signal, it starts reading data .
After last MSB bit is received, then follows Parity bit, which allows user to control received information by parity or he can skip the control. If control is selected, then bit will be Logic'1' if there will be even number of ones and Logic'0' otherwise. After byte is received, UART stores it in data register and informs that data is ready to take. Microcontroller has to read this byte before next byte is received. Otherwise data will be lost.
Usually hardware checking of received data is disabled, because it is substituted by CRC (cyclic redundance check) calculation and transmition. Receiver first receive the data array where is also a CRC code, then receiver recalculates CRC and compares to received one. If CRC codes doesn’t match than transmission is repeated.
Data bits are sent with a predefined frequency, the baud rate. Both the transmitter and receiver must be programmed to use the same bit frequency. After the first bit is received, the receiver calculates at which moments the other data bits will be received. It will check the line voltage levels at those moments.
HANDSHAKING:
what is hand shaking?
This type of flow control has the advantage that it doesn't require any more wires as the characters are sent via the TD/RD lines. However on slow links each character requires 10 bits which can slow communications down.
Parity:
Cable length is one of the most discussed items in RS232 world. The standard has a clear answer, the maximum cable length is 50 feet, or the cable length equal to a capacitance of 2500 pF. The latter rule is often forgotten. This means that using a cable with low capacitance allows you to span longer distances without going beyond the limitations of the standard. If for example UTP CAT-5 cable is used with a typical capacitance of 17 pF/ft, the maximum allowed cable length is 147 feet.
The cable length mentioned in the standard allows maximum communication speed to occur. If speed is reduced by a factor 2 or 4, the maximum length increases dramatically. Texas Instruments has done some practical experiments years ago at different baud rates to test the maximum allowed cable lengths. Keep in mind, that the RS232 standard was originally developed for 20 kbps. By halving the maximum communication speed, the allowed cable length increases a factor ten!
RS232 cable length according to Texas Instruments Baud rate Maximum cable length (ft) 19200 50 9600 500 4800 1000 2400 3000
The transmission rate of serial devices is called baud. It is the number of changes in the signal per second
Cable length is one of the most discussed items in RS232 world. The standard has a clear answer, the maximum cable length is 50 feet, or the cable length equal to a capacitance of 2500 pF. The latter rule is often forgotten. This means that using a cable with low capacitance allows you to span longer distances without going beyond the limitations of the standard. If for example UTP CAT-5 cable is used with a typical capacitance of 17 pF/ft, the maximum allowed cable length is 147 feet.
The cable length mentioned in the standard allows maximum communication speed to occur. If speed is reduced by a factor 2 or 4, the maximum length increases dramatically. Texas Instruments has done some practical experiments years ago at different baud rates to test the maximum allowed cable lengths. Keep in mind, that the RS232 standard was originally developed for 20 kbps. By halving the maximum communication speed, the allowed cable length increases a factor ten!
Baud rate | Maximum cable length (ft) |
---|---|
19200 | 50 |
9600 | 500 |
4800 | 1000 |
2400 | 3000 |
Logical 1 is indicate negative level, while logical 0 is indicate positive level. Allow voltage levels are state in table
|
The RS232 connector was originally developed to use 25 pins. In this DB25 connector pinout provisions were made for a secondary serial RS232 communication channel. In practice, only one serial communication channel with accompanying handshaking is present. Only very few computers have been manufactured where both serial RS232 channels are implemented. Examples of this are the Sun SparcStation 10 and 20 models and the Dec Alpha Multia. Also on a number of Telebit modem models the secondary channel is present. It can be used to query the modem status while the modem is on-line and busy communicating. On personal computers, the smaller DB9 version is more commonly used today. The diagrams show the signals common to both connector types in black. The defined pins only present on the larger connector are shown in red. Note, that the protective ground is assigned to a pin at the large connector where the connector outside is used for that purpose with the DB9 connector version.
RS-232 DB9 to DB25:
RS232 serial loop back test plugs:
The following RS232 connectors can be used to test a serial port on your computer. The data and handshake lines have been linked. In this way all data will be sent back immediately. The PC controls its own handshaking. The first test plug can be used to check the function of the RS232 serial port with standard terminal software. The second version can be used to test the full functionality of the RS232 serial port with Norton Diagnostics or CheckIt.
Testing occurs in a few steps. Data is sent on the Tx line and the received information on the Rxinput is then compared with the original data. The signal level on the DTR and RTS lines is also controlled by the test software and the attached inputs are read back in the software to see if these signal levels are properly returned. The second RS232 test plug has the advantage that the ring-indicator RI input line can also be tested. This input is used by modems to signal an incoming call to the attached computer.
RS232 null modem cables
The easiest way to connect two PC's is using an RS232 null modem cable. The only problem is the large variety of RS232 null modem cables available. For simple connections, a three line RS232 cable connecting the signal ground and receive and transmit lines is sufficient. Depending of the software used, some sort of handshaking may however be necessary. Use the RS232 null modem selection table to find the right null modem cable for each purpose. For a Windows 95/98/ME Direct Cable Connection, the RS232 null modem cable with loop back handshaking is a good choice.
RS232 null modem cables with handshaking can be defined in numerous ways, with loopback handshaking to each PC, or complete handshaking between the two systems. The most common null modem cable types are shown here.
RS-232 spy cable(Monitor cable):
HALF DUPLEX:
To monitor the RS-232 serial communication between two devices with a PC. To do this you need the RS-232 monitor cable which is displayed in the next picture. Two sockets are connected straight through. The spy computer is connected to the third one. This monitor cable taps communication from two sources on only one RS-232 receiver port. This means that if the two devices happen to talk simultaneously, the monitored information will be garbage. In most circumstances communication protocols work half duplex, in which case this RS-232 cable will work without problems.
NOTE:Just knowing about RS-232 is not enough to interface with external hardware,because we cannot directly connect the output of RS-232 to External hardware like MC'c and MP'c which often are TTL logic Families,TTL logic families work with lower voltages generally with 5V.But the output from RS-232(o/p of computer) are raw bits which have voltage levels of -15V to -3V(for logic '0') and +3V to +15V(for logic '1'),these logic levels of pc o/p is not compatible with logic levels of TTL external hardware which has +2V to +5V( for logic'1') and 0V to 0.8V(for logic'0').
SO FOR TRANSLATION OF LOGIC LEVELS TO THE DESIRED LOGIC LEVELS OF EXTERNAL HARDWARE(TTL) WE NEED TO USE AN IC MAX232.to know how to connect this MAX232 to RS232 plz read my post IC MAX232 FOR INTERFACING RS-232 WITH EXTERNALHARDWARE
Tidak ada komentar:
Posting Komentar