Open hemanti0503 opened 6 years ago
I have no real idea about what is going on here. Could you try reading a byte at a time using the read_bytes
method ?
Fist of all, thank you for your help!
Unfortunately, this also leaves out every second character:
>>> import visa
>>> visa.log_to_screen()
>>> rm = visa.ResourceManager('@py')
2018-07-11 09:43:43,539 - pyvisa - DEBUG - SerialSession was correctly imported.
2018-07-11 09:43:43,660 - pyvisa - DEBUG - USBSession and USBRawSession were correctly imported.
2018-07-11 09:43:43,686 - pyvisa - DEBUG - TCPIPSession was not imported cannot import name 'TCPIPSession'.
2018-07-11 09:43:43,695 - pyvisa - DEBUG - GPIBSession was correctly imported.
2018-07-11 09:43:43,697 - pyvisa - DEBUG - Created library wrapper for unset
2018-07-11 09:43:43,698 - pyvisa - DEBUG - Created ResourceManager with session 6814469
>>> sg = rm.open_resource('GPIB::02::INSTR')
2018-07-11 09:43:52,415 - pyvisa - DEBUG - GPIB::02::INSTR - opening ...
2018-07-11 09:43:52,424 - pyvisa - DEBUG - GPIB::02::INSTR - is open with session 4015412
>>> sg.write('*IDN?')
2018-07-11 09:44:01,550 - pyvisa - DEBUG - GPIB.write b'*IDN?\r\n'
<StatusCode.success: 0>
>>> sg.read_bytes(1)
2018-07-11 09:44:06,126 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'I'
>>> sg.read_bytes(1)
2018-07-11 09:44:07,630 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'R'
>>> sg.read_bytes(1)
2018-07-11 09:44:08,606 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'2'
>>> sg.read_bytes(1)
2018-07-11 09:44:09,406 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'2'
>>> sg.read_bytes(1)
2018-07-11 09:44:10,174 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'B'
>>> sg.read_bytes(1)
2018-07-11 09:44:10,894 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'2'
>>> sg.read_bytes(1)
2018-07-11 09:44:11,630 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'2'
>>> sg.read_bytes(1)
2018-07-11 09:44:12,286 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'0'
>>> sg.read_bytes(1)
2018-07-11 09:44:12,894 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'/'
>>> sg.read_bytes(1)
2018-07-11 09:44:13,582 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'4'
>>> sg.read_bytes(1)
2018-07-11 09:44:14,286 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b','
>>> sg.read_bytes(1)
2018-07-11 09:44:14,895 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'4'
>>> sg.read_bytes(1)
2018-07-11 09:44:15,486 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'4'
>>> sg.read_bytes(1)
2018-07-11 09:44:15,950 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'/'
>>> sg.read_bytes(1)
2018-07-11 09:44:16,398 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'4'
>>> sg.read_bytes(1)
2018-07-11 09:44:16,926 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'/'
>>> sg.read_bytes(1)
2018-07-11 09:44:17,582 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'1'
>>> sg.read_bytes(1)
2018-07-11 09:44:18,334 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'0'
>>> sg.read_bytes(1)
2018-07-11 09:44:19,102 - pyvisa - DEBUG - GPIB::02::INSTR - reading 1 bytes (last status None)
b'\n'
I am no specialist of linux-gpib and I have no idea how to fix this. @tivek may know more. Otherwise I can try to look at linux-gpib but it may take a while.
As a side note, using the Python module installed with linux-gpib, it works flawlessly. So I'm using that for now. If you need any more info, I will be happy to provide you.
Hi,
I'm trying to control a IFR 2026B signal generator using the Agilent 82357B USB-GPIB adapter on Raspbian Stretch. After compiling
linux-gpib
, I can confirm that the connection works usingibtest
:However, using
pyVisa
'squery
orread
method, only every second character is read:rm.list_resources
doesn't list my device, but the Keysight manager in Windows doesn't either, so I'm not too concerned about it as long as I can open it directly by specifying the address. However, you can see the problem about the reads above.Here is some more information about my setup:
Is there some configuration, that I've missed or some parameter I should set? Seems really weird to me, since in
ibtest
everything works correctly without any extra configuration. Please let me know if you need any further information.Thank you very much for your help!
Hemanti