I am able to read and write from/to a signal generator using miniterm.py. There is no read_termination character in the stream, (per the manual from the device manufacturer). I have attached debug output from miniterm to show a few transactions. Is there something I am missing to get pyvisa to read an arbitrary length return string without termination?
------------------------miniterm output --------------------------
Settings: /dev/ttyUSB0 9600,8,N,1 RTS: active DTR: active BREAK: inactive CTS: inactive DSR: inactive RI: inactive CD: inactive software flow control: inactive hardware flow control: inactive serial input encoding: UTF-8 serial output encoding: UTF-8 EOL: LF filters: debug default direct
[TX:'R'] [TX:'M'] [TX:'W'] [TX:'\n'] [RX:'3'] 3 [RX:'6'] 6 [TX:'R'] [TX:'F'] [TX:'W'] [TX:'\n'] [RX:'0'] 0 [TX:'R'] [TX:'M'] [TX:'A'] [TX:'\n'] [RX:'2'] 2 [RX:'0'] 0 [RX:'0'] 0 [TX:'R'] [TX:'F'] [TX:'A'] [TX:'\n'] [RX:'1'] 1 [RX:'0'] 0 [RX:'0'] 0 [RX:'0'] 0
Any pointers in the right direction would be helpful. This is a really strange type of device. Most everything I have tried ends in either a 'device in use' or 'timeout' error.
Thank you in advance.
Robin
The read_data() function below solved the problem to some extent. Now to figure out why back to back writes fail unless time.sleep(x) of about .2 seconds is not used between writes.