Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if the CIC is sending data when being the listener in that transaction?

We are switching from our custom-build interface board, build around the NAT7210 chip, to the standard NI interfaces.

I am currently working on porting the code to the NI 488.2 libraries.

 

In our custom implementation we were able to check the DI (Data In) bit in the Interrupt Status Register 1 of the NAT7210 chip to see if the CIC already did write a byte.

Using this, we were able to poll the interface, without actually having to call ibrd.

We could even combine this with an interrupt on that bit, so we did not even have to poll, but just could wait for the interrupt, before we started reading.

 

I am unable to find, in the documentation of the NI 488.2 libraries, if I can achieve something similar with those libraries.

 

Is something like this possible with the NI 488.2 libraries?

Or do I have to revert back to a polling mechanism, where I do a ibrd of one byte, with a small timeout, so I can do an ibwrt without having to wait for a long timeout?

0 Kudos
Message 1 of 3
(3,919 Views)

Hi yamahabest,

 

I've been passing through the documentation for the 488.2 commands and there isn't a specific command to achieve the same functionality. 

 

I think the method you have been using in polling using ibrd in order to actually determine the data on that byte would be the implementation to use with the 488.2 libraries.

 

 

Nic

Nic O
Applications Engineer
National Instruments UK&Ireland
0 Kudos
Message 2 of 3
(3,753 Views)

The exact functionality you mentioned isn't available through the NI-488.2 API, but you can develop a state machine which monitors the devices addressed state to determine when to read.

 

I wasn't able to locate sample code for this, but the approach goes something like this:

 

1. Use ibwait (or ibnotify) to detect when TACS or LACS is set.

 

2. Begin the appropriate I/O using asynchronous operations (ibrda, ibwrta), with infinite timeouts. Using asynchronous operations will allow you to stop them later using ibstop. Infinite timeouts ensures that you will not receive part of a command due to a timeout in the middle.

 

2. Use ibwait or ibnotify to detect either completion of your I/O (CMPL) or a change in the device's addressed state (TACS, LACS, DCAS)

 

3. If you received DCAS, or if TACS/LACS switched you between talker and listener, then cancel the current I/O operation with ibstop.

 

4. Goto step 1.

0 Kudos
Message 3 of 3
(3,573 Views)