LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simple RS-232 advice for labview novice

Help I'm lost in a mound of confusing LabView Information!!

I have an old RS-232 instrument which I want to send simple ASCII
commands to. No need to read anything back or do any handshaking. I am
running Windows XP Pro and have a serial port COM1. I can send
individual commands no problem using hyperterminal in Windows. Now I
want to do the same from LabView 6.1.

There are no labview drivers etc available for my instrument.

I've looked at the serial.vi examples and labview advice of what to do
when there are no drivers, but frankly I lost as to what I need to do.
Although the vi's look simple the problem is that they seem to use
NI-VISA and I don't really understand what this is. For instance
whether this is something that i
s used for communicating with the
actual instrument (which I doubt would be compatible with my old
instrument) or whether it's something that is needed for driving the
serial port itself from Windows.

So any advice on how to do the kind of simple equivalent of the basic
DOS type commands like:

open (com1:9600,N,8,2) for random as #1
print #1, "A"
close #1

and whether the labview examples would work would be appreciated.

Thanks Ed

ps Just to emphasise I'm running XP - don't know if this make things
harder?
0 Kudos
Message 1 of 3
(2,784 Views)
You can use either VISA or the older serial functions.
Both of them interface to the serial port of your computer. VISA is an API that works with not only serial instruments, but also GPIB, VXI, and TCP/IP. The theory behind VISA is that a single driver can be used for an instrument no matter how it's connected to the computer. The fact that your instrument is old should have no bearing on whether you use VISA or not. VISA does require more files (and larger) to be installed on the computer whereas the old serial drivr requires only one small one (serpdrv). This can be a factor if you build an application and want to distribute it. NI is no longer supporting the old serial drivers and there has been some recent speculation about whether they will be pa
rt of future LabVIEW releases. I almost always use VISA but then I almost always have GPIB instruments mixed with my serial ones and I have to install VISA anyway. In your application, since you just want to write to the instrument, all you need are two functions. Use the VISA Configure Serial Port (check the name, I'm not on a computer with LabVIEW right now) where you specify the baud rate, etc., and then a VISA Write with the command you went to send as the write string. To the VISA configure, you can create a constant or front panel VISA Resource Name. Click on it to select Com1. Connect the VISA REsource Out of the configure to the VISA Resource In of the VISA Write. Do the same with the Error Out/Error In, create an Error Out indicator from the VISA Write to check if any errors occurred and you're done.
Message 2 of 3
(2,784 Views)
Sure - do a VISA open, write, then close. I've attached a simple vi that does this. For VISA resource, select the COM port you want to open from the drop down menu on the front panel.

Btw, XP doesn't change the way NI-VISA works (that's one of the great things about NI-VISA!).
0 Kudos
Message 3 of 3
(2,784 Views)