Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem when writing to GPIB without opening

I read NI-488.2 manual, but can't found an answer for following question.

Firstly, I opening GPIB with ibdev, then clearing it. Then I sending some commands like "RF " (set frequency), "RF?" (get frequency). Then I turning off/on GPIB device, and waiting while it'll be ready to work. At that moment if I send "RF ..." to device, writing of command fails, and I get an error. That is OK, that is according to manual.

But, if writing once more without opening GPIB, write operation completes successfully. During first command, that fails, I think, GPIB driver sending some request to instrument, that makes device to initialize GPIB interface, and next GPIB commands work.

It's strange, why it's working after turning off/on device, also why only first write operation fails? Is it undocumented feature of NI TNT4882?

Message Edited by NoAngel on 03-30-2007 05:47 PM

--
Best Regards,
NoAngel
0 Kudos
Message 1 of 6
(4,186 Views)

I performed additional testing...

When open GPIB from PC then power OFF then power on there are 2 cases:

1) Last write to GPIB operation was Reading data from GPIB (for example command, that requires reply from device "RF?" -> "900.00;"). In that case all works OK when turning on power again without reopening GPIB by calling ibdev... NRFD is low.

2) Last write to GPIB operation was Writing data from GPIB (for example command, that not requires reply from device "RF 900" -> <no reply>). In that case NRFD becomes high after write operation, then turn OFF, ON power, and it's still high even after TNT4882 hardware (and software) reset (that performed during executing InitGPIB() )! So after powering ON in that case any command, sent to GPIB, becoming

Message Edited by NoAngel on 04-01-2007 05:08 PM

Message Edited by NoAngel on 04-01-2007 05:12 PM

--
Best Regards,
NoAngel
0 Kudos
Message 2 of 6
(4,155 Views)

So any write or read operation after power ON causes ENOL(2). After sending that command NRFD becomes =0(low) (why?). Then, next commands are OK. But If after power off I disconnect GPIB cable from device, then wait 5 seconds, then connect it again, it works immediately after power ON (why?..).

I cannot understand reason of such operation. Please if You have any ideas about it, send it to me. Thanks.

--
Best Regards,
NoAngel
0 Kudos
Message 3 of 6
(4,149 Views)
I think you may need to enable readdressing for this use case to work properly.  Basically, when you open a device handle using ibdev, then read/write to from it the driver will address the device to talk or listen.  The driver caches the addressed state of the instrument.  When you turn on/off the power to the instrument the state the driver thinks the instrument is in will be incorrect.  However, you can force the driver to always readdress the instrument, and not cache the state of addressing. 

All you need to do is call ibconfig(ud, IbcREADDR, 1).  This call will force the driver to always readdress the device.

Hope this helps.

Craig
National Instruments Engineer
0 Kudos
Message 4 of 6
(4,119 Views)
Thank You very much for help, Craig!
I'll try it.
--
Best Regards,
NoAngel
0 Kudos
Message 5 of 6
(4,097 Views)
Tested it. Now working.
Thank You, Craig!

It completely solved problem from PC side. Is there any way to perform the same configuration, but on TNT4882 side (TNT4882 configuration register, etc. ...)?

Because we're making device, not software for PC and want to make it work (if possible) without using ibconfig... .

Message Edited by NoAngel on 04-04-2007 11:29 AM

--
Best Regards,
NoAngel
0 Kudos
Message 6 of 6
(4,089 Views)