LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB Problems

I am able to communicate with an instrument in MAX, but any kind of GPIB
command I issue in
labview gets me this error:

NI 488 Command requires GPIB controller to be controller in charge.

Now, I know this is a common problem, because I read the support for this on
NI.com.

My problem is that I don't understand the solution.

The solution seems to be- use the GPIB Initialize.vi. Okay I can do that
without error- but on the next command- GPIB write, I will get an error.

1. I don't understand what the address string should be.
Should it be 9 for the address of the device?
Should it be 0 to specify the bus? (I only have one controller)
Should it be GPIB0::09::INSTR?
The online help in labview is not very helpful to me.

2. Why don't the example VI's from N
I actually use the GPIB initialize.vi?
I'm looking at this nice little example that sets up a techtronix scope- it
doesn't use the initialize vi?

3. When I communicate with the device in MAX, the remote light comes on-
when I close out of there, the light goes out. I can't get this into remote
through any labview commands.

4. I understand command termination is very important. My manual says that
I can terminate with a carriage return, semicolon, etc. I have tried the
different modes.

5. MAX just has a button "communicate with instrument"- and whatever that
does, it seems to work with most any device (despite termination, etc)- why
can't there be a vi that is like this?
I'm not looking for something higher level- just make the thing do what it
says it will.

Thanks for any help.
Message 1 of 5
(3,460 Views)
Instead of using the GPIB functions, just use VISA Write and Read. To Write - drop the VISA Write onto the diagram and create either a constant or control for the VISA Resource Name input. You click on the little arrow of the VISA Resource Name to select the instrument you want to communicate with. Wire a string constant or control to the Write Buffer input and enter your command there. Don't worry about a command termination. To do a read, just use the VISA Read and specify the number of bytes - you should use a number greater than what you expect. VISA Read will terminate automatically if the instrument meets 488.2 standard.

This should work for all but some really old GPIB instruments. I'm also assuming that you have LabVIEW 6.x. Older versions are onl
y a little more different.
0 Kudos
Message 2 of 5
(3,460 Views)
AS a bit of a clarification: The standard VISA name for your instrument (assuming that it is on GPIB address 9) is: GPIB0::9::INSTR. GPIB0 is for the first GPIB card in the computer (or the only card) and 9 is for the instrument address. No initialization is required for VISA.
If you are using GPIB (not VISA) VIs to talk to the instrument, then just use the address of the instrument. In this case "9". Using the GPIB VIs, you may need to use the GPIB Initialization.VI.
Hope this helps.

Rob
0 Kudos
Message 3 of 5
(3,460 Views)
The address string parameter is different in GPIB Initialization.vi than in the other VIs: you use the parameter in GPIB Initialization.vi to reference the address of the GPIB controller (typically 0) and in the other VIs to reference the device (for example, 9). The GPIB Initialization.vi automatically configures itself to use the controller address that you configured in MAX, so frequently you don't need to wire this parameter at all. The documentation is slightly inaccurate with regards to the address string parameter, and will be fixed in the next revision of LabVIEW.
0 Kudos
Message 5 of 5
(3,460 Views)
the VISA vis work perfectly. much easier to work with. thanks.
0 Kudos
Message 4 of 5
(3,460 Views)