LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS-232 commulication

how do make a connection through RS-232 serial port with the computer?
do i need a DAQ card that can connect RS-232 or i can just connect my
device to computer's serial port and make the computer communicate
with my instrument? if i don't need DAQ card to do so, how do make
the computer talk to my instrument through RS-232?
thanx
0 Kudos
Message 1 of 3
(2,957 Views)
Hi, Jason..
You're asking several questions. Labview can communicate via RS232 using the PC's built-in COM-1 and (usually) COM-2 ports. There are sample VI's in the NI website for testing this, if you need to get to that point, including a loopback.vi which is useful for testing the computer's serial ports, which default to 9600 baud on most PCs. Other old example VIs include Serial.vi and others, and may also be in the examples folder of your Labview installation.

In the Labview software are a number of VISA.vi's which can also be used to communicate with the serial port.

Now, if you're using a National Instruments DAQ unit, or one which NI has provided drivers, it may be as simple as connecting an RS232 cable between the PC and your DAQ instrument, then runni
ng the Labview Explorer under DAQ SOLUTIONS on the main panel - this can go out and examine what's connected to the machine, and what Labview can tell about it. Remember that the serial cable may need to be a "null modem" cable, meaning that the transmit and receive pins (usually 2 and 3) need to be swapped on one connector. If you get the loopback.vi working first, it may be easier on you since you'll know that the basic serial communications is working to start with.

If you have to build your own serial application to talk to a special device, there is a lot of help online here and folks who have done that. Serial communications tends to be a bit tricky, but quite do-able.

Hope this helps,

Dave
0 Kudos
Message 2 of 3
(2,957 Views)
You need a RS-232 serial communication port. Most desktop PCs have at least one (usually marked "COM1").

To communicate with your device you need to know the following:

1) Is it DTE or DCE? If it is a DCE device, you can use a "straight through" cable to connect to it. Otherwise you need a "crossover" cable.
2) What are its communication settings? Baud rate, data bits, etc.
3) What protocol does it use? Perhaps there is a LabVIEW driver already available (search the dev zone).

Once you know these pieces you can connect your device and open a VISA session to send and receive messages. In addition you can use a tool like the instrument I/O assistant to create your own instrument driver.
0 Kudos
Message 3 of 3
(2,957 Views)