Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending GPIB commands

Hi,
How to send string commands to GPIB(IEEE488) from PC?
The functions "GPIB CMD" and "MISC" not working.
If use: "cmd 4+0 4" not answer. Why?
Duke
0 Kudos
Message 1 of 6
(9,378 Views)
Duke,

Are you trying to send strings to your instrument to retrieve measurements from your device, or actually trying to send device-level commands to your device (interface-level commands)? If you do not know what interface level commands are, then most likely you're wanting to send data strings to your instrument. For this, you will use IBWRT/IBRD functions of the 488.2 driver, but I would like more information about what you're doing:

-What operating system are you using?
-What development environment? (LabVIEW, CVI, C++?)
-What, in general, are you trying to accomplish?

Hope this helps,
Scott
0 Kudos
Message 2 of 6
(9,378 Views)
Hi, Scott,
I am using Windows XP, LabView 6.01

I have a measuring device which controlled with BASIC program. Now I am trying to use LabView for cotrol this device.
A BASIC program statement such as:
LISTEN 4 SCG 12 DATA "1"
On LabView it looks like GPIBWRT function with address string "4+12" with LF on the end and data string "1"
This statement is working well and the device shows result !

The statement like this : LISTEN 4 SCG 2 K
with GPIBRD function is also working well.

But I can't make on LabView the statement like this, because it needs for device control:
LISTEN 4 SCG 0 CMD 4

This statement sends standart command
to my device.
Using "MISC" function I can send this command, LV write "no error" in status string, but system nothing doing.

I can't understand what is incorrect ?
May be I am using wrong function, may be I am using wrong command syntax.

In LabView help command syntax described as: cmd string command where as I supposed cmd means ADDRESS "4+0" and cmd string = "4"

But really the functions "GPIB CMD" and "MISC" not working.
Why?
Duke
0 Kudos
Message 3 of 6
(9,378 Views)
Duke,

I'm not exactly sure what message you're wanting to send to the device; I am not familiar with the BASIC syntax that you are referring to, especially since all your reads, writes, and commands start with the "LISTEN" directive?

As you may or may not know, you can address a GPIB device to send data or to send a command. To address a device and send data (like a "*IDN?" or some sort of query for measurements), you will want to use GPIB Write and GPIB Read VI's. For commands, you can use GPIB CMD. However, the command value 4 doesn't make much sense by itself. "4" stands for "Selected Device Clear" in the GPIB multiline messages.

Should you be sending the "4" command (Selected Device Clear)?? Or just the 4 data? If you want to send the
command, you probably would send a "talker aa, Listener xx, subaddress yy" command to the bus to specify where you want the command to be sent, where aa is the GPIB address of your board, xx is your device's gpib address, and yy is your device's sub address. Look in the links below to construct a string of gpib commands that do this, then you can feed this string into GPIB CMD.

This link has information about low-level GPIB commands that may be helpful:link

Here is some getting started info for IBIC, a text-based interactive control for GPIB interfaces that may allow you to experiment to see what exact GPIB command will do what you want: link

Hope this helps.

Scott
0 Kudos
Message 4 of 6
(9,378 Views)
Hi Scott
Thank you very much for your help.

You quite right.
My string looks: SEND 7; LISTEN 4 SCG 0 CMD 4 UNL
I want to send a command "set device clear"

As I understand you, I have to make like this:

1). Select a GPIBCMD function.
2). to the terminal "bus" joint "7"
3). to the terminal "command string" joint "4+0 cmd 4" ??? Is it correct?
(This is the main question.)

Duke
0 Kudos
Message 5 of 6
(9,378 Views)
Hey Duke,

The "bus" terminal indicates the GPIB bus number on which you want to issue a command. If you have only 1 GPIB board in your system, this should be "0". The command string terminal is will require a series of bytes to: Address the Talker (your GPIB board), Address the Listener (your device), Subaddress the listener (your device's sub address), send the "4" command, then Unlisten. Each task has a byte, and you need to look up the bytes in Table 1 of that first link of my original post to make sure they're correct.

Here's what I think you might need:
(These are all hex, so make sure your constant is in "Hex mode display")

0x40 <-Address your GPIB board at address 0 as the talker
0x24 <-address your device at add
ress 4 as the listener
0x60 <-subaddress 0
0x04 <- your actual "4" command
0x3f <-unlisten

Note that I assumed your board was at address 0. You should definitely look up these hex codes in the table I referred to above just to get an idea as to what all this is doing so that you can troubleshoot it a bit more if there are issues.

Hope this helps.

Scott
0 Kudos
Message 6 of 6
(9,378 Views)