Work is planned to expand the Python Scriptin documentation beyond what is currentlyu available in the product documentation. There are also a number of example Python scripts that are today supplied with the product (See Scipting Demo entry in the help menu).
In case of help on a specific functionality that is not covered with the available material, please contact support.
i have a problem on python and c script. i try to automatic test Agilent DC power supply on python or c script, but python and c script do not recognize "GPIB0::2::INSTR"
my computer plug to the power supply via NI GPIB cable i have connection in the Agilent app ('GPIB0::2::INSTR') but not on my scripts
my os is win 7 64_bit i have visa drivers i have NI drivres, connection expert app and NI IO trace app python 2.7 (IDLE for win 7) pyvisa lib
---------------python_script-------------------------------------------------------------- ython 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import visa >>> rm = visa.ResourceManager() >>> rm.list_resources() (u'ASRL1::INSTR', u'ASRL2::INSTR', u'ASRL3::INSTR', u'ASRL10::INSTR') >>> osci = rm.open_resource('GPIB0::2::INSTR')
Traceback (most recent call last): File "", line 1, in osci = rm.open_resource('GPIB0::2::INSTR') File "C:\Python27\lib\site-packages\pyvisa\highlevel.py", line 300, in open_resource return self.visalib.open(self.session, resource_name, access_mode, open_timeout) File "C:\Python27\lib\site-packages\pyvisa\ctwrapper\functions.py", line 1059, in open library.viOpen(session, resource_name, access_mode, open_timeout, byref(out_session)) File "C:\Python27\lib\site-packages\pyvisa\highlevel.py", line 171, in _return_handler raise errors.VisaIOError(ret_value) VisaIOError: VI_ERROR_LIBRARY_NFOUND (-1073807202): A code library required by VISA could not be located or loaded. >>> -----------------------------------------------------------------------------------------------------------------------
-------------------------------------------C_script-------------------------------------------------------------------- /*idn.c This example program queries a GPIB device for an identification string and prints the results. Note that you must change the address. */ //#include "sicl.h" #include #include
void main () {
ViSession defaultRM, vi; char buf [256] = {0};
/* Open session to GPIB device at address 22 */ viOpenDefaultRM (&defaultRM); printf("calling viOpen...\r\n"); viOpen (defaultRM, "GPIB::2::INSTR", VI_NULL,VI_NULL, &vi);
/* Initialize device */ viPrintf (vi, "*RST\n");
/* Send an *IDN? string to the device */ viPrintf (vi, "*IDN?");
In case of help on a specific functionality that is not covered with the available material, please contact support.