Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VB6 VISA equivalent commands to CWGPIB commands

I am setting up a VISA class in VB6 to perform the same functions as the Component Works CWGPIB control. I have the Read and Write and configuration of primary address down, but need a couple more items to allow compatibility with wrapper classes we've written for other instruments. Below are the commands I need to write equivalent declaration functions for:
 
CWGPIB1.Configure
CWGPIB1.DataAsString
CWGPIB1.Wait
 
I have a spectrum analyzer function that needs to setup the control to read the information from the spec an as a byte array and instead, all I have is reading in as a string.
 
Can anyone offer any assistance with emulating these control functions in my new class?
 
Thanks,
Tom
0 Kudos
Message 1 of 6
(4,462 Views)

Hi Tom,

I am assuming that you have communication working using CWGPIB commands in Measurement Studio, as an addon to VB6, and that you are trying to implement the same functions using VISA commands. 

If this is the case, I recommend taking a look at the NI-VISA help file.  Under NI-VISA Help>>Function Reference, all the different GPIB commands for VISA are listed, with their corresponding VB syntax.  I will look further into the underlying 488.2 functions being called under the CW commands to see if there are equivalent VISA commands for them.

Let me know if you have made any progress on this and if I am understanding the issue correctly.

Regards,

Lauren L.

Applications Engineering
National Instruments
0 Kudos
Message 2 of 6
(4,423 Views)

Thanks Lauren,

Yes, the previous setups used the CWGPIB control and I'm trying to use the NI VISA dll to perform the same functions. I've got the basic "Read" and "Write" working, but I like to use the wait command to ensure I don't send a read command before the last command is fully processed. It's saved me on setting up multiple sleeps in the code. I've been referencing the help file and it's well written, but I couldn't tell what I needed to do for setup and then which commands I would use to get a read. An example is reading Trace Data from a spectrum analyzer in byte format. Performing reads with a byte array versus one big string was a function of the control. Reading trace data using the byte array was much faster than reading in as a string.

Thanks again,

Tom

0 Kudos
Message 3 of 6
(4,386 Views)

Hi Tom,

Are you saying that you are unclear how to use a wait function with VISA commands?  If I am understanding you correctly, the viWaitOnEvent function should serve this purpose.  If you have questions about the syntax, let me know, but I believe that the help file has a fairly good description of the parameters.

Regards,

Lauren L

Applications Engineering
National Instruments
0 Kudos
Message 4 of 6
(4,368 Views)

This is one of the items I need to resolve. I believe there is some preliminary setup required to use this. Also, I was not clear on if it only worked with asynchronous reads/writes or if it worked with standard read/writes as well. I think there was some register setting that needed to be performed, but couldn't discern what was needed. Thanks.

0 Kudos
Message 5 of 6
(4,365 Views)

Hi Tom,

The default status of the WaitOnEvent function is to handle events asynchronously.  In LabVIEW, the function can be modified to handle operations synchronously by changing the "Synchronous I/O Mode" to "Synchronous".  As of yet, I am not sure what the corresponding command is (if there is one) in VB, although I am looking into it.

Regards,

Lauren L

Applications Engineering
National Instruments
0 Kudos
Message 6 of 6
(4,337 Views)