Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How to control the separate pins of a dsub 9 contact?

I have a device that has a DSUB 9 contact (as commonly used for RS 232). The device is a pump with a frequency control that can be controlled externally. The pump is controlled explicitly, meaning that one square pulse on pin 1(see attached image from manual)in the DSUB 9 contact correspond to one stroke. I would like to make a LabView interface to control the pumping frequency of this pump. The pump can be operated between 0.5 Hz and 205 Hz, so what I need is some way on setting pin1 high and low in a pace corresponding to this frequency, preferably using the DSUB9 contact on my laptop directly. Similarly, I also want to read out digitally the state of pin 3.

Please advice on how to go about.

Christopher


0 Kudos
Message 1 of 15
(5,325 Views)

Hi Christopher,

What I read I don't think  your device (Pump) will work with a RS-232 interface. Pin 1 is a input and pin 3 is data. 

You also need to you what levels your device is using then we can see what interface you can use.

0 Kudos
Message 2 of 15
(5,305 Views)
The pump signals are TTL, so I guess I have figured out that I will need some intermediate electronics to correct the levels.
0 Kudos
Message 3 of 15
(5,303 Views)

There are several options:

The COM port. You need 1 IC (max232) to convert the signals from RS-232 <--> TTL

The parallel port (if present). You can connect the device directly but I would advise to use a buffer IC between you laptop and device. Certainly if you are using longer interface lines and/or different power sources.

You can buy a simple USB interface device with digital I/O

With the last option you don't have to solder but it will cost something. With the first option you have to solder and will cost a few $

0 Kudos
Message 4 of 15
(5,301 Views)
First issue to be considered is the voltage level of the control signals of your pump. Most external devices use TTL level signals, i.e. a logic 1 is equivalent to a high voltage level (of 2.8 to 5.0V) and a logic 0 is equivalent to a low voltage level (0.0 to 0.8V). The signals on RS232 connectors on PCs etc have different levels, they swing between +5...+12V and -5...-12V. Anyhow, you cannot control the pins of a RS232 port on a PC separately. There are pins for the signal to be transferred, and these are controlled by the UART on the mainboard of your PC. The UART transmits a sequence of signals for each byte it receives from the CPU (this is a strong simplification), hence the signal pins will not have a stable state. There are some other pins transmitting and receiving control signals - but these are controlled by the UART, too, depending on the method of data transmission. The bottom line is, it is NOT possible to use a RS232 port to control an external device requiring TTL level signals and requiring several digital input signals. Only way to control your external device is using the printer port (usually a 25pin D-SUB connector). It is possible to control most of the pins of this connector seperately. Another way might be using a digital I/O board plus an adaptor. Also, there are several vendors offering digital I/O devices controlled by the USB port, including software drivers allowing for easy control of the digital lines.
0 Kudos
Message 5 of 15
(5,294 Views)

It is no problem to control the RS-232 handshake lines with a labview program.  Smiley Surprised

There are U(S)ART's that control the handshake lines and they are also controllable through registers (Modem Control Register) in these U(S)ART's

With a level translation you hve a very cheap 2 bit I/O



Message Edited by K C on 11-19-2007 03:06 PM
0 Kudos
Message 6 of 15
(5,288 Views)
Thanks for the info on how to control the handshake lines. A very basic level converter can be built with a transistor, two resistors and a diode. There is no need for a separate power supply. This circuit can be powered from a +5V source on the external device and needs NOT to be powered in case the external device has pull-up resistors connected to the input lines (most devices have).
0 Kudos
Message 7 of 15
(5,280 Views)
PS. If you have to read a signal from the external device and you are doing this via the handshake lines of the RS232 port you will need a level translator from TTL to RS232 levels. As mentioned by others the easiest way is using a MAX232. This IC has several channels so you can also use it for translating the output from the RS232 port to your device.
0 Kudos
Message 8 of 15
(5,278 Views)

Back to where it started........................

Christopher,

Can I help you further with this interface ?

0 Kudos
Message 9 of 15
(5,260 Views)
A lot of useful answers, and I conclude that no matter what I do, I need some external electronics to account for the difference in levels. As I did not know the  basics properties of the DSUB9 contact when I posted my question, I initially hoped that there would be a simple, "software only" solution to the problem. I thank all of you that have posted useful answers and have, as a newbe to this forum, seen that it very active and useful.

Christopher
0 Kudos
Message 10 of 15
(5,256 Views)