Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send GPIB Bus Commands(LLO,GTL) by calling VISA API

I am writing an instrument driver in LABWindows/CVI. The driver defined a Boolean Attribute to let user to lock/unlock the intrument front panel keys.

In the attribute write callback routine, i wrote following code.

if (value==VI_FALSE)
viCheckErr( viGpibCommand(io, "GTL", strlen("GTL"),&ret));
else
viCheckErr( viGpibCommand(io, "LLO", strlen("LLO"),&ret));

but I get an error, is there anybody tell me how to fix it.

Thanks
0 Kudos
Message 1 of 3
(5,787 Views)
Hello Tom,

You must use the hex values for the commands. Instead of using "GTL" use "\x01", and instead of "LLO" use "\x11".

Also, viGpibCommand is a board level command. If you try to use it as a device level command, you will get an error.

I hope this helps.

Kim L.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(5,786 Views)
Tom:

A better way to do this (still with your INSTR session) is the function viGpibControlREN. I know what you are doing has nothing to do with REN proper, but this function is overloaded to perform other things related to remote/local state. Therefore, I suggest the following 2 modes for what you are doing:

VI_GPIB_REN_ASSERT_ADDRESS_LLO (5) - this will assert REN, address your device, and send it LLO

VI_GPIB_REN_DEASSERT_GTL (2) - this will address the device if necessary, send it GTL, and deassert REN

Properly using viGpibCommand on the INTFC session will work as well but will require an additional session.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
0 Kudos
Message 3 of 3
(5,786 Views)