Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change state of GPIB control lines when not CIC, problem with iblines

Hello,

 

I am writing code as the device/instrument as another system is the CIC. It is polling iblines to obtain the status, and my gpib device is reporting that NRFD is active. I cannot find a way to control these lines to be able to set the state of the control lines. I don't understand why GPIB is setting this line high when I first find the gpib adapter and setup device settings. Is there a function that will clear the control lines, when not CIC? ibclr and other functions error as my system is not the CIC.

 

Thanks

Phil

0 Kudos
Message 1 of 14
(4,006 Views)

Can you tell me a little bit more about your application? Are you using LabVIEW or another programming language? What GPIB device are you using?

CH
Applications Engineering
National Instruments
http://www.ni.com/en-us/support.html
0 Kudos
Message 2 of 14
(3,971 Views)

Hello,

 

I am using a GPIB USB HS adapter connected to a PC. I am using direct DLL with C calls after loading the DLL.My app is the device and I assert SRQ, then send (ibwrt) START message, and (ibwait) wait for and read (ibrd) REPLY. 

 

On the CIC I captured this trace: It does read and reply like it should but very slow due to iblines in between each command.

 

TestSRQ(0, TRUE (1))
 AllSpoll(0, {0x000E}, {0x0040})
 ibwait(0, 0x0000)
 ReceiveSetup(0, 0x000E)

 RcvRespMsg(0, "START..",
 ibsic(0)
 ibcac(0, 1)
 ibwait(0, 0x0000)
 SendSetup(0, {0x000E})

 SendDataBytes(0, "REPLY",

 

The problem is that in between each message, it repeatedly polls iblines() and result is 0x16FF which seems to have the NRFD bit set
 iblines(0, 0x16FF)
 until it see's the SRQ is set and this repeats many times, NRFD still set

 iblines(0, 0x36FF)

But the CIC eventually times out and then will process my START request. This iblines polling is taking over 1+ second to process which makes the interface very slow. 

 

I don't know why the NRFD line is set high, and I don't know how to change the state. Is there bus level commands that will allow me to change the state of NRFD?

 

Thanks

Phil

 

 

 

 

0 Kudos
Message 3 of 14
(3,960 Views)

I'm not super familiar with this, but I'd go into NI MAX > Help > NI MAX Help > Search and then search NRFD. I found the following:

 

IBLINES

 

returns the state of the GPIB control lines in clines. The low-order byte (bits 0 through 7) of clines contains a mask indicating the capability of the GPIB interface to sense the status of each GPIB control line. The upper byte (bits 8 through 15) contains the GPIB control line state information. The following is a pattern of each byte.

7 6 5 4 3 2 1 0
EOI ATN SRQ REN IFC NRFD NDAC DAV

To determine if a GPIB control line is asserted, first check the appropriate bit in the lower byte to determine if the line can be monitored. If the line can be monitored (indicated by a 1 in the appropriate bit position), check the corresponding bit in the upper byte. If the bit is set (1), the corresponding control line is asserted. If the bit is clear (0), the control line is unasserted.

Example

short lines;
iblines (ud, &lines);
if (lines & ValidREN) {  
   /* check to see if REN is asserted */
   if (lines & BusREN) {
      printf ("REN is asserted");
   }
}
CH
Applications Engineering
National Instruments
http://www.ni.com/en-us/support.html
0 Kudos
Message 4 of 14
(3,951 Views)

Hello,

 

Yes, this I am aware of. My problem is that my app/device is the instrument side. So the CIC is polling iblines and it is reading that my device has the NRFD line asserted. But I don't know why it is asserted or how to clear it on my device app.

 

What function can I call that will clear the NRFD control line?

 

Thanks

Phili

0 Kudos
Message 5 of 14
(3,943 Views)

Hello,

 

The GPIB Analyzer allows you to unassert lines from the main window. The NRFD line shows to be one of them.  Perhaps this is a way you can achieve this.

 

Using the GPIB Analyzer:

http://digital.ni.com/public.nsf/allkb/848F027883BD6429862571B8001DFEDC

CC
Applications Engineering
National Instruments
http://www.ni.com/support
0 Kudos
Message 6 of 14
(3,919 Views)

Hello,

 

I need to be able to do this in code. Can someone tell me why the line is asserted? Shouldn't the line be cleared when I do an ibrd()? Or when is the NRFD line low? What commands control the NRFD line?

 

Thanks

Phil

0 Kudos
Message 7 of 14
(3,916 Views)

I do not know the answer to this. I am going to do more research internally and get back to you as soon as I have an answer. If you are able, you may want to create a service request with NI to bring up your issue on the phone.

 

I will update this when I have a better answer for you!

CH
Applications Engineering
National Instruments
http://www.ni.com/en-us/support.html
0 Kudos
Message 8 of 14
(3,902 Views)

Hello,

 

Would ibonl()  reset the control lines? Help seems to state that it returns the device back to pre-configured state, so I am wondering if calling this before setting my SRQ will clear the control lines back to default state, so that the CIC will read the NRFD as low? 

 

Thanks

Phil

0 Kudos
Message 9 of 14
(3,898 Views)

I would try it and see. Does this occur every time you run your program or when you stop the program and start again? Make sure you are closing your session. To be honest, you'll need to consult the 488.2 standard to get more information on if this is even possible from the non-CIC.

CH
Applications Engineering
National Instruments
http://www.ni.com/en-us/support.html
0 Kudos
Message 10 of 14
(3,891 Views)