06-01-2010 02:01 PM
Is it best to call the viFindRsrc method, to get the "instrDesc" argument? The problem is, the instrDesc is a string, whereas the comm port object I want to set is a long int in my code... any suggestions?
viFindRsrc&(ByVal sesn&, ByVal expr$, findList&, retcnt&,
ByVal instrDesc$)
instrDesc -- OUT -- Returns a string identifying the location of a device.
Strings can then be passed to viOpen() to establish a
session to the given device.
06-01-2010 03:50 PM
06-02-2010 06:12 AM
To give you further background: I'm in a developer group that supports a chemistry lab. I'm updating a MS Access DB containing VBA code from Access 97/WIN NT using NI Control Works to Access 2007/WIN 7 using NI VISA. We use your software to connect the computer/DB to one or two chemistry measurement devices via RS232 serial ports. The thing is, the existing VBA code refers to the respective port as COM1, COM2, etc. which NI VISA refers to as "ASRL1::INSTR", as you said. I'm trying to avoid hard-coding the port name, though, b/c there may be more than one instrument attached to the serial board at a time... and so I want to be sure I'm opening the correct port by first querying viFindRsrc(). However, I've been looking through the NI VISA Programmer Reference Manual, and I can't seem to find an attribute that directly stores the comm port value/location. I thought it was "VI_ATTR_VXI_LA" but that doesn't seem to work for RS232 serial ports... Is there another attribute you know of that I can use?
06-02-2010 09:14 AM
06-03-2010 08:02 AM
Thanks for all your help so far!
On a related note, does anyone know which reference I need to check/activate in the VB Editor inside of MS Access in order for the NI Visa calls/code to work? The only listed reference is "National Instruments Max Ctrl 1.1". However, is there any other reference I should include from the NI Serial 3.5 driver disc?
06-03-2010 08:52 AM
CoalMiner wrote:Thanks for all your help so far!
On a related note, does anyone know which reference I need to check/activate in the VB Editor inside of MS Access in order for the NI Visa calls/code to work? The only listed reference is "National Instruments Max Ctrl 1.1". However, is there any other reference I should include from the NI Serial 3.5 driver disc?
The "Max Ctrl" is only if you're trying to program MAX, which you're not doing. NI-Serial is only used if you have NI serial boards or NI serial interface products like the USB<->Serial devices. If you are using the COM ports directly on the computer you do not need it. For NI-VISA you need to include niglobal.bas and vbib-32.bas. This is stated in the NI-488.2 Help file.