LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I do to initialize my serial port with Labview 7?

I try to understand what function I must use to communicate with a device linked to my serial port. Someone can help me??
Thank you!!
0 Kudos
Message 1 of 3
(4,470 Views)
Hi,
In the function palette -> Instruments I/O -> Serial (See also VISA)

You'll probably have to use :
- VISA configure serial port : Baud rate, # stops, # bits
- VISA Read : read the bytes at port
- VISA Write
- Property node Bytes at port
- VISA Close

Don't forget to close the VISA Session at the end of your application.

Hope this helps !
Julien
Message 2 of 3
(4,470 Views)
Hi Zyl

Initializing the serial Port in LV7:

1. Go to the block diagram.

2. In the Functions Palette, select => Instrument IO => VISA => VISA Advanced and place the VISA Open vi on the block diagram.

3. Wire a "VISA resource name" control to the VISA Open vi. Also wire the Error-IN / OUT clusters appropriately.

4. Select the COMM port that you wish to use to connect to your instrument. (ex: COM1).

5. In the Functions Palette, select => Instrument IO => Serial; this is where you will find most of the useful VISA vi's relating to the serial communication.

6. Place the VISA Configure Serial Port.vi on the block diagram. You can wire the settings to this vi. You can use the Context Help for details (it is useful to show the connectors on th
e vi).

You can start with the following vi's:

a) "VISA Bytes At Serial Port" which indicates how many bytes are available top be read at the serial port buffer.

b) "VISA Write" Wire the string that you want to transmit to this vi. This vi also provides a return count for the number of bytes at the serial port (echoed data for instance).

c) "VISA Read" Reads the serial buffer as an output string. This is where you will want to wire the byte count (as an input) from the two vi's above.

d) "VISA Close" A very important vi, because it closes the communication session to the COMM port. Very useful if you switch back and forth with a software like HyperTerminal.

I think that this should get you going with the serial port communication. You may want to implement some sort of a loop (while for instance) in order to read the data from the serial port buffer until it is empty. Depending on the speed of the communication, you may also want to place a delay within the loo
p.

JLV
Message 3 of 3
(4,470 Views)