PyVisa: broken characters when reading from GPIB

1

(This is probably the wrong forum, so I started an issue on GitHub: https://github.com/pyvisa/pyvisa/issues/254)

I try to control a Keithley instrument by using GPIB in python. Basically the communication works but when reading from the instrument often characters are broken. E.g.:

rm = visa.ResourceManager()
inst = rm.open_resource('GPIB0::5::INSTR')
inst.write_termination = '\n'
inst.ask('*IDN?')

gives

'[EYTXLUY0I^STRUMUNTS0I^C>,]OTE\\ 2306,1178362,B16  /B02  \n'

The same in National Instruments VISA Test Panel looks so instead:

3: Write Operation (*IDN?\n)

Return Count: 6 bytes

4: Read Operation
Return Count: 57 bytes
KEITHLEY INSTRUMENTS INC.,MODEL 2306,1178362,B16  /B02  .

When I check in NI I/O Trace both calls seem similar:

NI test panel:

3.  viWrite (GPIB0::5::INSTR (0x01FBD908), "*IDN?.", 6, 6)
Process ID: 0x000013E0         Thread ID: 0x00001390
Start Time: 12:57:52.691       Call Duration 00:00:00.022
Status: 0 (VI_SUCCESS)

4.  viRead (GPIB0::5::INSTR (0x01FBD908), "KEITHLEY INSTRUMENTS ...", 1024, 57)
Process ID: 0x000013E0         Thread ID: 0x00001390
Start Time: 12:57:52.892       Call Duration 00:00:00.028
Status: 0 (VI_SUCCESS)

Python:

5.  viWrite (GPIB0::5::INSTR (0x02B67068), "*IDN?.", 6, 6)
Process ID: 0x0000017C         Thread ID: 0x000007AC
Start Time: 10:27:22.794       Call Duration 00:00:00.013
Status: 0 (VI_SUCCESS)

6.  viRead (GPIB0::5::INSTR (0x02B67068), "[EYTXLUY0I^STRUMUNTS0...", 20480, 57)
Process ID: 0x0000017C         Thread ID: 0x000007AC
Start Time: 10:27:22.808       Call Duration 00:00:00.020
Status: 0 (VI_SUCCESS)

Does someone have an idea?

py -m visa info
Machine Details:
   Platform ID:    Windows-7-6.1.7601-SP1
   Processor:      x86 Family 6 Model 42 Stepping 7, GenuineIntel

Python:
   Implementation: CPython
   Executable:     C:\Users\vos\AppData\Local\Programs\Python\Python36-32\python.exe
   Version:        3.6.0
   Compiler:       MSC v.1900 32 bit (Intel)
   Bits:           32bit
   Build:          Dec 23 2016 07:18:10 (#v3.6.0:41df79263a11)
   Unicode:        UCS4

PyVISA Version: 1.8

Backends:
   ni:
      Version: 1.8 (bundled with PyVISA)
      #1: C:\Windows\system32\visa32.dll:
         found by: auto
         bitness: 32
         Vendor: National Instruments
         Impl. Version: 15728640
         Spec. Version: 5243904
      #2: C:\Windows\system32\visa32.dll:
         found by: auto
         bitness: 32
         Vendor: National Instruments
         Impl. Version: 15728640
         Spec. Version: 5243904

Other commands in python:

>>> inst.ask(':FETC?')
'+4.99963273E+00\n'

seems correct, but this isn't:

>>> inst.ask(':FETC:ARR?')
';4>99964076E;00,;4>99963733E;00,;4>99963424E;00,;4>99962772E;00,+4.99962361E+00\n'

To compare from NI VISA Interactive Control:

1: Write Operation (:FETC?)

Return Count: 6 bytes

2: Read Operation
Return Count: 16 bytes
+4.99963273E+00\n

3: Write Operation (:FETC:ARR?)

Return Count: 10 bytes

4: Read Operation
Return Count: 80 bytes
+4.99964076E+00,+4.99963733E+00,+4.99963424E+00,+4.99962772E+00,
+4.99962361E+00\n
visa
gpib
pyvisa
asked on Stack Overflow Jan 20, 2017 by Volker • edited Jun 14, 2019 by John Hennig

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0