Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Wait On Event (GPIB Listen) succeeds when not addressed as listener

I am using LV to construct a GPIB instrument.  It will listen and respond when addressed but never be the CIC.

 

The code so far is based on the vi at http://www.ni.com/example/28508/en/ (.png file attached, I think that will work).  My codes is on a stand-alone computer and I don't want to re-write it, so I will use the example code and describe mine.

 

Note the VISA Wait On Event configured for a GPIB listen event.  The first time I run the vi, the Wait On Event times out if I don't send anything from the CIC, as expected.  If I send something, Wait On Event succeed, VISA Read reads the message I am sending from the other computer, then VISA Write sends the response.  Good so far.  

 

However, on the next loop the VISA Wait On Event should time out if not addressed - it does not time out, it plows on through as if another listen event has occurred.  VISA Read errors out.

 

I have several GPIB status reads in place for troubleshooting.  On a correct cycle, LACS and TACS are active when you would expect.  At the beginning of the next loop, LACS and TACS are cleared.  There is no Listen even present on the second loop.

 

I have the remote CIC set to Unaddress the instrument after reads and writes.  If I don't do that, LACS stays up after the Listen event.  The CIC has to actively unlisten the instrument.  That is the only way I have found around this.

 

Is this a VISA issue or a NI-488.2 issue or a hardware issue?

 

TIA

 

Ed K

Message 1 of 4
(4,762 Views)

Hi Ed,

 

Can you supply a screenshot of the code you have within the ‘True’ case of the Case Structure?

Also, what specific hardware are you using?  

 

Nik

0 Kudos
Message 2 of 4
(4,703 Views)

The end that will be the instrument (non-CIC):

PXI-8106 controller with built-in PCI-GPIB

LV2011SP1

NI-488.2 3.0.2

NI-VISA 5.1.1

XP SP3.  

 

The CIC is a laptop with XP SP3 

GPIB-USB-B

LV2009 SP1

NI-VISA 5.0.3

NI-488.2 2.8.1

 

No screenshots of my code, because it is a stand-alone computer and I can't get it's code exported.  

 

I decided to bypass the whole VISA wait for event stuff as being too clever.  My new code configures the GPIB interface as a non-CIC at address 1, then loops around a VISA Read.  The read times out at 100ms intervals, which I handle in the loop.  This way the loop keeps running and can be stopped at will.  The loop stops with a button press or when VISA Read returns a non-zero value for byte count.  I can then parse the text and decide to write a response or not.  (.png file attached)

 

I did this because of troubleshooting using NI-VISAIC and finding that the Wait For Event appears to be unreliable even in that environment.  

 

Any advice about this solution?

0 Kudos
Message 3 of 4
(4,684 Views)

I have taken your approach and tested it out and found some issues generally not seen until you properly investigate all possible usage cases. Attached is an example code is well documented for anyone to use using two GPIB controllers on the bus. For example, GPIB0 (GPIB-USB-HS) and GPIB1 (GPIB-ENET or GPIB-USB-HS) are attached to the same PC (this will work if you have two separate PCs to interface with GPIB cards). When you run the attached example it will programmatically create a GPIB instrument on the bus with GPIB0::1::INSTR handle that you can use in NI-MAX to look up by initiating "Scan for Instruments" command. This GPIB instrument will respond to the only required "*IDN?" or "*idn?" to stuff NI-MAX settings for attached instrument. From there (NI-MAX) under GPIB0::1::INSTR you can also initiate "Communicate with Instrument" to bring up the 488.2 Communicator and send the "*IDN?" query commands to get the identification string.

 

There were some errors needed to be ignored to make it functional under NI-VISA.Please see attached example compiled in LabVIEW 2018. I will also attache a jpg images for viewing purposes. Thanks,

 

Iqbal Sihra

Message 4 of 4
(2,440 Views)