From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem calling agn6700_InitWithOptions()

I have a Agilent N6700B power supply. I use the following function to init it:
rtn = agn6700_InitWithOptions ("GPIB::5::INSTR", /* resourceName */
VI_TRUE, /* IdQuery */
VI_TRUE, /* resetDevice */
"Simulate=0,RangeCheck=1,QueryInstrStatus=0,Cache=1,DriverSetup=Module1:N6762A;Module2:N6752A;Module3:N6742A;Module4:N6745A",
&gAgn6700);

The return value is ok (=0), and I can do other initialization and set the desired voltage level, etc. BUT, right after this function call, I checked the front panel of the power supply. It showed some errors, like
"GPIB: Error, -222 Data out of range"

If I call this function in the following way:
rtn = agn6700_InitWithOptions (GPIB_DEV_ADDR_N6700, /* resourceName */
VI_TRUE, /* IdQuery */
VI_TRUE, /* resetDevice */
"Simulate=0,RangeCheck=1,QueryInstrStatus=1,Cache=1",
&gAgn6700);

I got no errors on the front panel, but the return value is 0xBFFA0020.

Pls somebody explain this to me. Thanks a lot.
Jason
0 Kudos
Message 1 of 6
(3,746 Views)
Hi Jason,

Thank you for using our discussion forums. NI technical support doesn't support the function calls for third-party devices, but I did some research on it anyway. The return value of 0xBFFA0020 probably indicated that GPIB_DEV_ADDR_N6700 does not contain a valid address. Specifing GPIB::5::INSTR explicitly seemed to work the first time. As far as the "GPIB: Error, -222 Data out of range" message, you might try contacting Agilent to see if they can help.

Good luck,
0 Kudos
Message 2 of 6
(3,729 Views)
Hi Jason,

Please can you attach spy log. I'll check where is problem. I can detect when this problem has been occurred in spy log file. Driver sets only current and voltage trigger mode during initialization. I don't understand why driver returns an error when ID_QUERY is enabled. in this case spy log can help too.

NI-Spy:
1) Start >> All Programs >> National Instruments >> NI-Spy
2) Spy >> Options >> View Selections ( NI-IVIDCPwr, NI-VISA should be checked) Confirm with OK
3) Press F8
4) Run your application
5) File >> Save as and store log file.

Thanks,
Zdenek
0 Kudos
Message 3 of 6
(3,709 Views)
I'ved attached the log file "capture_spy.txt". You have to rename it to *.spy. I only ran the line where it calls agn6700_InitWithOptions() and stopped my application to avoid too much logs.

Thank you very much.
Jason
0 Kudos
Message 4 of 6
(3,706 Views)
Hi Jason,

The spy capture that you attached doesn't seem to have any errors in it. You seem to be addressing the correct device, and the device isn't returning any errors. The *IDN? command is returning the device ID. Since the *IDN? command is the last command issued, try issuing a reset then *IDN? to see if this command is the one causing the incorrect response. Try each command one at a time to see if you can find the source.

Good luck,
0 Kudos
Message 5 of 6
(3,693 Views)
Hi Jason,

I saw spy log and it does not help me 😕

Please use following function for init.
rtn = agn6700_InitWithOptions ("GPIB::5::INSTR", /* resourceName */
VI_TRUE, /* IdQuery */
VI_TRUE, /* resetDevice */
"Simulate=0,RangeCheck=1,QueryInstrStatus=1,Cache=1", &gAgn6700);

and spy it again.
QueryInstrStatus will query *ESR? and we will see when error has been occured. of course it will be called only once on the end of every high level function.
When you remove the list of modules from option string and id query is set to VI_TRUE, driver will detect modules automatically. I can see your hardware configuration.
Please check in your spy that you have enabled spy for ivi drivers too. May be it's not possible on your PC when you did not install IVI Driver Toolset.
Spy>>Options[View Selections page] and if there you will find NI-IVIDCPwr, please enable it.



Zdenek
0 Kudos
Message 6 of 6
(3,686 Views)