From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Is issueing multiple IBWAITs the best way to incorporate max time?

My application is given a max-time parameter that tells how long it should wait to recieve data from my instrument after requesting data. The max-time can be anywhere from 2 seconds to 480 seconds.
Currently I send an IBWAIT (TIMO|ERR|SRQI). If SRQI then I send IBRSP to the instrument. I don't feel comfortable changing the GPIB time-out time. Is it possible to put the IBWAIT command in a 'while' loop and compare time from when issued and when finished, and issue another IBWAIT if TIMO was returned on the first IBWAIT? Or, is there a better way to do this?
Thank you for any help.
0 Kudos
Message 1 of 9
(4,455 Views)
Hi,

I don't see any problems. A timeout error (or any error) does not close the GPIB reference, so you can call other driver functions, such as ibwait.

As a reference, if you are waiting for a service request for a particular device (using device-level unit descriptors), you should use the RQS mask for ibwait. When a service request occurs, the driver performs an Automatic serial poll, to determine which device generated the RQS. The driver will wake up only the ibwait call for that particular device, if you are waiting for several devices to request service. The SRQI mask is to detect if the SRQ line was asserted (any device requesting service).

DiegoF
National Instruments.
0 Kudos
Message 2 of 9
(4,456 Views)
If I have 5 devices on my GPIB bus, can I call ibwait in each of the 5 threads I have created to read the response of each device ?
I am afraid that the CPU will be tied up?
Don't U think?
Thanks
0 Kudos
Message 3 of 9
(4,435 Views)
You should be able to call IBWAIT on each device as long as when one thread within a process calls ibwait on a given descriptor, another thread within the same process is not already performing an ibwait using that same descriptor (see NI-488.2 Help under "EWIP"). I haven't been able to find any documentation about the CPU getting tied up with 5 calls to IBWAIT at once.
0 Kudos
Message 4 of 9
(4,418 Views)
I am actually programming under linux RedHat 8.0 with C langage.
The truth is my gpib release is 0.8.5 and I wonder if this release is thread safe
Is there any example of synchronous blocking read in C under linux?
Thank U
0 Kudos
Message 5 of 9
(4,411 Views)
Julien,

No the 0.8.6 driver is not multithread safe. If you need this functionality you can try the latest beta driver available at www.ni.com/beta.

Shawn B.
National Instruments
Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 6 of 9
(4,389 Views)
Hi Scott,

I was in contact weeks ago about a pb with gpibintctrl under linux RH 8.0 with beta 2.3.
I have downloaded 2.5 as U suggested it, and install it in place of 2.3

But the pb is the same, the buffer returned by ibrd under gpibintctrl cannot be greater than 16 bytes !!!
What is the pb?

Example :

: ibdev 0 9 0 13 0 0x0a

ud0: ibwrt "*IDN?\r\n"
[0100] ( cmpl )
count: 7

ud0: ibrd 16
[0100] ( cmpl )
count: 16
48 45 57 4c 45 54 54 2d H E W L E T T -
50 41 43 4b 41 52 44 2c P A C K A R D ,


ud0: ibrd 17
[2100] ( end cmpl )
count: 15
00 00 00 00 00 00 00 00 . . . . . . . .
00 00 00 00 00 00 00 . . . . . . .
0 Kudos
Message 7 of 9
(4,285 Views)
Julien,

Did you restart your machine following the installation? We did experience a very similar issue with DMA that required us to reboot the machine before using the driver.

Craig A.
National Instruments Engineer
0 Kudos
Message 8 of 9
(4,277 Views)
Yes, I do it many times and I use many GPIB devices for the same behaviour.
0 Kudos
Message 9 of 9
(4,265 Views)