LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measurement Studio GPIB Control

I'm using NI's Measurement Studio with VB6 to develop an application.
My question concerns the GPIB Active X control. I'm trying to use a
single GPIB control to communicate with several instruments by
changing the ".PrimaryAddress" property to the instrument I'm trying
to talk to. In this scenario, the GPIB communication is not reliable.
However, if I add an individual control for each piece of test
equipment, the GPIB communication is OK. This is my first app using
Measurement Studio and I'm wondwring if using a single control (my
preferred method) is not the recommended approach? Any advice would be
appreciated. Thanks in advance.
0 Kudos
Message 1 of 5
(2,895 Views)
I had the same problem and ended up doing the same thing (two GPIB objects). One thing you can do to make coding a bit easier is to make an array of two controls... cwGPIB1(0) and cwGPIB1(1).
0 Kudos
Message 2 of 5
(2,895 Views)
Hello,
The recommended approach is definitely to use multiple gpib controls, this is much easier on a conceptual level as well as a coding level (each device has it's own component and name). If for some reason you do need to use a single component, it should be possible, but you can't simply change the Primary Address property. When switching devices you should call the CWGPIB.Reset method, then configure all settings (such as PrimaryAddress) then call the CWGPIB.Configure method.

Hope that helps,
Ryan
NI Applications Engineer
0 Kudos
Message 3 of 5
(2,895 Views)
ryank wrote in message news:<506500000005000000DD370100-1066448259000@exchange.ni.com>...
> Hello,
> The recommended approach is definitely to use multiple gpib
> controls, this is much easier on a conceptual level as well as a
> coding level (each device has it's own component and name). If for
> some reason you do need to use a single component, it should be
> possible, but you can't simply change the Primary Address property.
> When switching devices you should call the CWGPIB.Reset method, then
> configure all settings (such as PrimaryAddress) then call the
> CWGPIB.Configure method.
>
> Hope that helps,
> Ryan
> NI Applications Engineer
Thanks for the response Ryan. I was trying to get away from
hard-coding my app and
just use a single control. The following code
produced erratic results. The variable "CurrGpibAddr" is the current
instrument I'm trying to write to and "stCommand" is the string to
write.

With GPIB_Dev
.Reset
.BoardNumber = 0
.PrimaryAddress = CurrGpibAddr
.Configure
End With
GPIB_Dev.Write stCommand

If you have any suggestions I would appreciate them.
0 Kudos
Message 4 of 5
(2,895 Views)
This code seems correct, what do you mean that it produces "erratic results"? The only thing I can think of that could be causing erratic behavior is if you set some other property of the CWGPIB control for the first device and then forget to set it back to default for the second device. Make sure that you reset any properties that you have previously set, and stop any asynchronous processes before reconfiguring. Try running the "Basic GPIB" example that ships with Measurement Studio, send a command (such as an identify query) to one device, then change the address, click the configure button and send a command to another device.
0 Kudos
Message 5 of 5
(2,895 Views)