LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 serial Port help

Hi,
I'm kind of new in LabView and I'm using LV 7.
How can I send and recive data from the COM port?
I run the example came with LV 7 and I recive an error: "Property Node in VISA Configure Serial Port (Serial Instr).vi->Serial Communication.vi"

Regards,
Rotem
0 Kudos
Message 1 of 6
(10,793 Views)
Your problem should be in the configuration of the port itself.

Assumming you are trying to use the "Basic Serial Write and Read.vi" example, on the left side of the panel are the parameters to configure the port. You must select the correct port name (Com1, Com2...) and correctly select the other parameters to match what you are trying to communicate with.

Have a look at the documentation for what you are trying to talk to and make sure you have everything setup correctly.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 2 of 6
(10,780 Views)
Hi rreiss,

You can right click on the error cluster indicator and do an "Explain Error". This may provide some explanation, where to start looking. Another method is when you get an error number, you can search its meaning under the HELP menu, by selecting "Explain Error".

Using the serial port with LV is actually simple and "fun". My first suggestion is to be able to communicate with the Instrument using a sofware like HyperTerminal in order to make sure that the serial communication is functional. Next, you configure the serial port communication in LabView by using the "VISA Configure Serial Port" to select which port talks with the instrument or Device Under Test (DUT). You can use a "VISA Resource Name" control on the front panel to identify which port is used with a given instrument.

All the communication settings are done with the Configure Serial Port vi. This is where you would set the communcation speed, stop bits, etc.

You then send commands to the instrument using communicate with the VISA Write. You can monitor responses by checking the number of bytes at the serial port and diplaying it using a VISA Read and attaching the output string to a display (on the front panel).

(From memory - PC with LV is away from me):

From your block diagram, go to your Functions Palette.
Within that, look under Instrument IO.
Go to VISA, then VISA Advanced.
Place a VISA Open on your block diagram.
Go back to Instrument IO, but this time go into Serial. In there you will find the vi's to configure the serial port, read, write and close the port.

Of course, open the serial port first by placing a VISA Resource Name Constant to the OPEN VISA vi. This is where you select which COMx port you want for which instrument.

To read data at the serial port, use the "bytes at serial port" property node to measure the bytes available to be read. Give this number to the VISA Read function."

And one last thing. don't forget the "CRLF" - end of line character / enter - ...
otherwise, your command may not be sent 😉

-JLV-
Message 3 of 6
(10,741 Views)
I've always had trouble using VISA in conjunction with USB-serial conversions, both in my development environment and in deployed applications built from that code. I use legacy serial devices (which are non-replaceable!) and have LV 6x I/O compatability VI-based drivers that work -- even with the USB-serial conversion (using the KeySPan 19HS device and its native driver). However, the problem is that, when I try to use the "native" VISA-based translations of those legacy VIs, I am consistently running up against an error -37 AFTER the first successful read. So, I boot my development VI, run it, successfully find and read the device but then click the stop button -- in the development environment. If I then restart the development code, I then consistently get error -37, even if I unplug the USB device an then replug it in.
0 Kudos
Message 4 of 6
(10,727 Views)
Hi,
I want to explain something very important, I'm not using NI Device or computer or something, all I want to do is to turn on led that is connected to pin number 3 (TxD).
Can I do that in LV?
One more question, It is difficult to work with the USB in LV? Baceuse I know that in other languages it is very hard..

Regards,
Rotem
0 Kudos
Message 5 of 6
(10,686 Views)
Check this KB out about Error 37, I am sure you will find your answer there:

http://digital.ni.com/public.nsf/websearch/FF3549C9A30DC37B862569650049E098?OpenDocument
Message 6 of 6
(10,671 Views)