09-10-2009 02:51 PM
hello
is it possible to control, using labview, the inputs and the outputs of a serial port as they were simple digital on/off channel?
for example in order to use them to turn on/off a relay or to read the state of a switch
I've searched among the labview examples but they show only complex communication to an hardware using strings...
thankyou in advance
paolo
Solved! Go to Solution.
09-10-2009 03:26 PM - edited 09-10-2009 03:27 PM
You can control the handshaking lines Request to Send (RTS) and DTE Ready (DTR). You can read the handshaking lines DCE Ready (DSR) and Clear to Send (CTS) as digital inputs.
They are accessed through property nodes of the VISA reference under Serial Settings / Modem Line settings.
Be careful of any loads you apply to them or signals you enter in terms of voltage and current so you don't fry your computer.
09-10-2009 03:30 PM
The voltages out of serial port are also highly variable.
If you are willing to risk your pc, you can try the parallel port which is 0-5V. That's assuming your pc even has a parallel port.
09-11-2009 02:57 AM
first of all thak you for your quick answers
now:
if insted of using a real serial port I use a usb->serial converter, is still true what you said?
in this case is the output stable at 5V (in the range of the usb)?
and furthermore, can I ask to this serial port the 0.5 A typical of an usb?
is the same for a usb->parallel converter?
paolo
09-11-2009 08:51 AM - edited 09-11-2009 08:53 AM
Using a USB converter MIGHT give you an extra level of isolation on the signal path, but that depends on how it is designed.
I really doubt you will be able to source 1/2 A from USB. That is the maximum amount of current the port could handle, and you often have to share that with other USB ports. And almost certainly a handshaking pin on serial, or a data pin on parallel is not going to be able to supply that much current.
You could use the pins to drive a transistor which switches on or off a larger voltage and current source. Search the forums and the web for schematics of how to do this.
Otherwise, I think you'd be better off getting an inexpensive digital input/output board such as the Measurement Computing brand.
09-11-2009 10:27 AM - edited 09-11-2009 10:29 AM
The USB -> Serial must have a charge pump circuit in it to get the serial levels correct, so you may have negative voltage on the line. Heed the warnings in the post. The parallel port idea is fairly safe and very easy, if you can go that route. There's enough drive there to light LED's, but I would not try a relay.
edit: and regarding what Bucs Fan said, I've bought digital I/O boards off eBay for < $50, some with a relay (and mosfet driver) already on it.
09-15-2009 05:06 AM
hello ravens
I tried to implement the simple vi you shown me, but I have quite a stupid problem...
all the connectors are on the right, as they were all input channels, as you can see in the figure
(I'm using a USB-> serial converter)
do you know the reason and how can I solve the problem?
thank you
paolo
09-15-2009 05:16 AM
Mazzo wrote:
all the connectors are on the right, as they were all input channels, as you can see in the figure
Right click and select "Change all to write"
09-15-2009 01:31 PM
Some of those properties are not writeable.
For the ones that are, you can right click on those and select Change to Write. (a bit farther down in the context menu)
06-04-2011 02:08 PM
Hi
I am new with labview and was wondering if anyone can help out
What I am trying to do is read and write to a serial port while capturing the data
The device I want to control has many menues
I can access the device easily and can capture the text with hyperterminal but no success with Labview
I seem to get the first line only if I use the "basic read and write" vi that is posted on this site so, I assume it is writing OK but reading stops after the first line
Can anyone help?