Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

same command to multiple instruments

Solved!
Go to solution
Solution
Accepted by topic author nyc_(is_out_of_here)
Your approach is right.
 
ATN-TRUE (ibcmd)
0x40 - Talker Address 0
0x2A - Listener Address 10
0x2B - Listener Address 11
ATN-FALSE (ibwrt)
(any device message you want)
 
or
 
ATN-TRUE (ibcmd)
0x40 - Talker Address 0
0x2A - Listener Address 10
0x2B - Listener Address 11
0x08 - get (Group Execute Trigger)
 
However, sending 0x3F (UNL) prior to lister desination is more robust if your system has other GPIB instruments. 
 
For example, if you have a device at address 7 and you have sent a command to it as like:
ibwrt ud_addr_7, "*RST\n"
 
the next ibcmd() call adds two listeners 10 and 11 but the device at 7 is kept listening.
ibcmd bd_gpib0, "\x40\x2A\x2B"
 
To exclude the device previously set as listener at 7, the ibcmd() call must be below:
ibcmd bd_gpib0, "\x3f\x40\x2A\x2B"
 
The 0x3F (UNL) command can make all the devices unlisten.
 
Makoto
0 Kudos
Message 11 of 19
(3,067 Views)
This is what I am doing in my subroutine so far
 
ilcmd (0, "\x3f\x40\x2A\x2B", 4)
 
ilwrt (0, "RE", 2)
 
 
This is suppose to reset both counters to count 0, but it is not working.
 
Am I suppose to do anything else prior to sending the ilcmd?
Should I be doing an ibdev or something?

Message Edited by nyc on 05-11-2006 05:00 PM

0 Kudos
Message 12 of 19
(3,049 Views)
ilwrt (0, "RE", 2)
 
This call does not send any termination characters (such as CR or LF) explicitly, though the default setting of ibdev() automatically generates EOI signal at the last byte.  You are using a very old HP instrument, therefore it may not understandand EOI signal as you expect and only requires an explicit termination character.  I have seen the same issue when I was using HP3478.
 
Try "RE\r", "RE\n", or "RE\r\n".
 
 
0 Kudos
Message 13 of 19
(3,041 Views)
No, that isn't it.

If I just talk to one counter at a time, I send an ildev and ilwrt(ud, "RE", 2), and it works.

The counters are HP5334.
0 Kudos
Message 14 of 19
(3,036 Views)

Seems like the HP5334 understands EOI signal because ilwrt(ud, "RE", 2) call is working well.  (ilwrt does not automatically appends EOS character.) 

One different point between board and device level calls is that you can't use ildev() for board level call (as NI-488.2M manual says so.)  I believe ilwrt() at board level automatically sends an EOI signal at the last byte as default, but this default is up to the GPIB system configuration on the device manager.  To ensure to send EOI, you can explicitly enable this with ileot() at board level call, not with ildev().

Other check points are:
(1) When you have sent the multiple listener addressing command, do the instruments indicate any REMOTE or LISTEN state?  If so the instruments look like being addressed.

(2) When you use ilcmd() and ilwrt() on board level call for single instrument only, does the instrument work?

(3) If you have a GPIB bus analyzer, it may be a shortcut to spy the GPIB trafic then compare the board and device calls

(4) Or, try using SendList() function as somebody is saying in this thread, which allows exactly what you want to do

regards,

0 Kudos
Message 15 of 19
(3,030 Views)
This is realy very simple.  Use 'SendList' as was stated in one of the previous posts
 
Here's an example it's in C++ but you should get the idea. I used this on two old HP signal analyzers and never had a problem.
 
STDMETHODIMP Chp3561a::StartAll(long Addr, long *ReturnVal)
{
 
 /* Method sends the 'Start Measurement' command to two a
 analyzers simultaneously.  2nd device must have PAD set to
 one value higher than 1st device*/
 int    count; 
 Addr4882_t  instruments[2];   //Array of device addresses
     
 for (count = Addr; count <= (Addr+1); count++)
 {
  instruments[count - Addr] = (Addr4882_t)count;}
 instruments[2] = NOADDR;
 SendList(0,&instruments[0],"STRT;\n", 5, NULLend);
 
 //check status bits
 if(ibsta & ERR)
  *ReturnVal = 0;
 else
  *ReturnVal = -1;
  
 return S_OK;
}
 
 
Curt
0 Kudos
Message 16 of 19
(3,022 Views)
Curt,
 
Can you tell me which functions you use to start up communication to the GPIB board?
 
I tried sending just the SendList command and using the integer 0 as the boardID, and nothing happens. The counters
are not even being placed in REM.
 
I also tried SendIFC(0) and then the SendList command, and that also doesn't work.
 
 
================
 

Makoto,
 
If I use IBIC everything works fine.
 
But the VB does not work.
Call ibfind("gpib0", niBoard)
Sleep 2000
Call ibsic(niBoard)
Sleep 2000
Call ibsre(niBoard, 1)
Sleep 2000
Call ibcmd(niBoard, "\x3F\x40\x2A\x2B")
Sleep 2000
Call ibwrt(niBoard, "RE")
0 Kudos
Message 17 of 19
(3,018 Views)

Follow-up:

Curt,

I did the SendIFC(0), and also missed that I needed to make the address array 1 bigger to hold the element NOADDR.

With these changes, the counters go into LSN mode but still did not execute the RE reset command.

 

Makoto,

When using the ibcmd through IBIC, the command  \x3f\x40\x2A\x2B  works and is interpreted as being 3 characters.

But when using ibcmd in Visual Basic environment  \x3f\x40\x2A\x2B  \x3f\x40\x2A\x2B  is interpreted as 12 characters. It looks like the escape characters don't work. Using NISpy showed me this. So when I send  ?@*+ it works beautifully.

 

Thanks to everyone for your help.

0 Kudos
Message 18 of 19
(3,009 Views)
Solution
Accepted by topic author nyc_(is_out_of_here)
The "\x3F" expression is a C Language escape sequence and it can't be used in VB.  As you think, you can use "?" expression for ASCII 0x3F.  If the ASCII code is not a printable character, you can also use Chr() function in VB as like:
 
Chr(&H3F) & Chr(&H40) & Chr(&H2A) & Chr(&H2B)
 
This line is finally a string expression of 4-byte characters.
 
0 Kudos
Message 19 of 19
(3,004 Views)