LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the difference between "VISA Write" and "viWrite"?

I am trying to control a piece of hardware through LabView over RS-232.  I just need to code up the correct hex values to send for each command.  I am using LabView 2012 and the VISA Write and VISA Read functions.  I have gotten a few commands to work in LabVIEW but I started to notice a problem with one where VISA Read failed after a VISA Write.  I verified that I am sending the correct hex values.  If I use NI MAX and send the exact same set of values the command works fine.  So using NI I/O Trace I can look into the write buffers listed on the property sheet for both the LabView and NI Max transmissions.  The buffer shows the exact same sequence of hex values for both.  However LabVIEW sends out a command "VISA Write" with "COM1" as an argument while NI Max sends out a "viWrite" with an argument ASRL1::INSTR.  For the LabVIEW command the Input tab on the property sheet only lists one parameter, "VISA resource name", set to "COM1"  However the NI Max command has four parameters listed as inputs:

 

vi   ASRL1::INSTR(0x07692970)

&buf    0x0B3840E4

cnt 6 (0x6)

&retCnt   0x0B1BA7FC

 

The Output tab on the property sheet lists no parameters wheras the NI Max output tab lists *retCnt 6 (0x6)

 

I am directly connected to the COM1 serial port (no USB)

 

 

Why do LabView and NI Max send different commands and parameters?

 

 

0 Kudos
Message 1 of 4
(3,780 Views)

I'm not sure how to answer your question but here is some advice.  Inside LabVIEW, click on "Find Instrument Drivers" and see if the manufacturer has already supplied drivers to interface with you equipment.  I was having issues connecting to a scale and did this search....problem solved.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 4
(3,747 Views)
The VISA Write and viWrite are the same. If you look in the c help file for NI-VISA, you'll see viWrite. The canonical name for Com1 is ASRL1 and VISA Write does in fact return the number of bytes written.
0 Kudos
Message 3 of 4
(3,739 Views)

Thanks for the replies.

 

I was able to resolve the LabVIEW error by replacing the "VISA Write" component that I used from the LV2012 library with the exact same part from a LV VI a colleague of mine had downloaded (I assume from this site) called SerialComm.vi.  It also sends out a "VISA Write" but works.  Apparently there is some difference in the instantiation of the part I placed from LV2012 vs the instantiation of the part that was copied from SerialComm.vi.  I tried to see if there was any version info associated with the parts but could not find it.  BTW I am using an XP machine. 

0 Kudos
Message 4 of 4
(3,718 Views)