Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB Poll

A probably elementary question but...
 
I have a real-time app that needs to poll a GPIB device at a low priority periodically for data and am trying to find out the best way to do this withought hangng up the code.  I am using the NI-DDK with DJGPP in protected mode DOS so I am running single threaded.
 
My instrument requires a command (ibcmd and ibwrt) then I read the approx 10 byte response (ibcmd and ibrd).  The device is slow and I dont want my code to hang oin the ibrd function.  What is the best way to poll the interface for the completion of the read function?
 
Thanks.
 
-Bob 
 
0 Kudos
Message 1 of 4
(3,953 Views)
Hi BobK2,

There is no 488.2 command that will poll to see if there are any bytes in the buffer. However, you can set a short timeout for the ibrd and use that as a workaround to poll the device. The timeout can be set by using ibtmo. There is more information on this in the NI-488.2 Help, which can be found in Start > Programs > National Instruments > NI-488.2

Let us know if you have any questions about this!
Rasheel
0 Kudos
Message 2 of 4
(3,912 Views)

Hello Bob,

From looking at the defined functions in the DDK, there is no option for an asynchronous read (only ni488_ibrd).  This means that the ibrd call you make will block until either the time-out expires or it receives the data coming from the instrument.  If you would like to poll for the ibrd, you can make the timeout really short using ibtmo.  This will allow you to slowly poll to see if the data has come in from your device.

I hope this helps,
Steven T.

0 Kudos
Message 3 of 4
(3,911 Views)
Hey, thanks for the info.  I was figuring that the work around would be along those lines.  -Bob
0 Kudos
Message 4 of 4
(3,882 Views)