Showing posts with label Interfacing and Project. Show all posts
Showing posts with label Interfacing and Project. Show all posts

RS232 Connections, and wiring up serial devices

Original use of RS232

When we look at the connector pinout of the RS232 port, we see two pins which are certainly used for flow control. These two pins are RTS, request to send and CTS, clear to send. With DTE/DCE communication (i.e. a computer communicating with a modem device) RTS is an output on the DTE and input on the DCE. CTS is the answering signal comming from the DCE.

Before sending a character, the DTE asks permission by setting its RTS output. No information will be sent until the DCE grants permission by using the CTS line. If the DCE cannot handle new requests, the CTS signal will go low. A simple but useful mechanism allowing flow control in one direction. The assumption is, that the DTE can always handle incomming information faster than the DCE can send it. In the past, this was true. Modem speeds of 300 baud were common and 1200 baud was seen as a high speed connection.

For further control of the information flow, both devices have the ability to signal their status to the other side. For this purpose, the DTR data terminal ready and DSR data set ready signals are present. The DTE uses the DTR signal to signal that it is ready to accept information, whereas the DCE uses the DSR signal for the same purpose. Using these signals involves not a small protocol of requesting and answering as with the RTS/CTS handshaking. These signals are in one direction only.

The last flow control signal present in DTE/DCE communication is the CD carrier detect. It is not used directly for flow control, but mainly an indication of the ability of the modem device to communicate with its counter part. This signal indicates the existence of a communication link between two modem devices.

Loop Back Connection

While the normal PC hardware might well run with just Tx, Rx and Ground connected, most driver software will wait forever for one of the handshaking lines to go to the correct level. Depending on the signal state it might sometimes work, other times it might not. The reliable solution is to loop back the handshake lines if they are not used.
When the lines are handshake looped, the RTS output from the PC immediately activates the CTS input - so the PC effectively controls its own handshaking.

Connection without handshaking

Connecting together two serial devices involves connecting the Rx of one device to the Tx of the other, and vice versa. The diagram below indicates how you would go about connecting two PC's together, without handshaking.



Connection With Full handshaking
When Handshaking is required, generally RTS of one device connects to CTS of the other, and vice versa, and also DSR of one device connects to DTR of the other device, and vice versa. The particular requirements for different equipment may vary.

Compatibility issues

The null modem cable with full handshaking does not permit the older way of flow control to take place. The main incompatibility is the cross connection of the RTS and CTS pins. Originally, these pins are used for a question/answer type of flow control. When the full handshaking null modem cable is used, there is no request anymore. The lines are purely used for telling the other side if communication is possible.


The main advantage of this cable is, that there are two signalling lines in each direction. Both the RTS and DTR outputs can be used to send flow control information to the other device. This makes it possible to achieve very high communication speeds with this type of null modem cable, provided that the software has been designed for it. Because of the high possible connection speed, this null modem cable can be used with Interlink to connect two MS-DOS PC's.

This is the type of cable Microsoft recommends for the direct cable connection in their knowledge base article. For the DB9 connector they also added a connection of DTR to CD on each connector but they didn't define this connection for the DB25 connector version and they also didn't mention the CD input in the descriptive text, so it is safe to leave the CD input disconnected.

Serial Interfacing : Send ADC data to PC serially - RS 232 using MIC AT89S51

>Serial Interfacing : Send ADC data to PC serially - RS 232

Dear al hand
Sometime we want transmit our data to the point that locatedat at long distance for our computer. It means that we must use serial port .

Before we proceed the project further, one big think that always must be remember, that computer process its data in pararel format default. Another one that we must concern, is standard voltage for serial data transmission is different with TTL voltage.

In order to convert from serial voltage standard in to TTL we use ic converter MAX22, and in order to convert serial data into parael data, we use mic 89s51

Image below shown the main concep of circuitry to send data from an ADC to a computer.



Step 2: Make the program, we can use assembly editor to write this program:

org 0h
call initserial
;
start: mov a,p2; pick data from adc
call Sendout; call sendout subs
sjmp start
;
Sendout:
detect: jnb ti,detect;
clr ti ;
mov sbuf,a ;
ret
;
initserial:
mov scon,#52h;initialize serial mode 1
mov tmod,#20h;timer1 mode 2
mov th1,#0F3h;Reload value for baud rate 2400
setb tr1
ret
end

Compile it to hex, then download it to the AT89s51 flash rom (using downloader).
This program will send 8 bit data to the RS 232 converter.


Interfacing tutorial and Software

  1. SmalPort, component for pararel port interfacing. Its very helpfull for making you first pararel interfacing project
  2. Designing_SPI_interface: step-by step tutor in designing SPP interfacing
  3. Analog Interfacing to Embedded Microprocessors Real World Design :This book about interfacing between an Mcs and I/O modul.
  4. Making pararel port interacing with PPI 8255.