LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial port control

Solved!
Go to solution

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

0 Kudos
Message 1 of 15
(6,143 Views)
Solution
Accepted by topic author Mazzo

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.

 

Message Edited by Ravens Fan on 09-10-2009 04:27 PM
Message 2 of 15
(6,132 Views)

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.

Message 3 of 15
(6,128 Views)

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

0 Kudos
Message 4 of 15
(6,101 Views)

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.

Message Edited by Ravens Fan on 09-11-2009 09:53 AM
0 Kudos
Message 5 of 15
(6,069 Views)

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.

Message Edited by Broken Arrow on 09-11-2009 10:29 AM
Richard






0 Kudos
Message 6 of 15
(6,055 Views)

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

0 Kudos
Message 7 of 15
(6,006 Views)

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"

 

untitled.PNG

Message 8 of 15
(6,002 Views)

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)

0 Kudos
Message 9 of 15
(5,958 Views)

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?

 

 

 

0 Kudos
Message 10 of 15
(5,303 Views)