0

I have gotten the Simulator to finally start communicating back to me (see past question); however, I do not know what it is saying to me. Here is a simple code that sends a message to the simulator.

`import serial

port = '/dev/tty.usbserial-PXFO5L2L'
baudrate = 9600
timeout = 1
ser = serial.Serial(port = port, baudrate = baudrate, timeout = timeout)

ser.write('VOLT:LEVEL 4')
`

This is supposed to set the voltage 4, but all it returns is 12. Along with other commands, they all return ints. Can anyone tell me what this means? Or if I am using the write command correctly?

Community
  • 1
  • 1
wfulton
  • 21
  • 3
  • What does your documentation state? – Wayne Werner Jul 25 '16 at 18:42
  • It says that there are bit storage locations 1-7 that it returns when there is an error. At first it was returning numbers 1-7 so I thought that was it, but then I started getting numbers like 12 and 56. It might be stating bits 1 and 2, and 5 and 6 but I don't really know. Also, It does not mention the download of any other USB/GPIB interface modules I need to download, so I don't think that is the problem. – wfulton Jul 26 '16 at 02:39
  • Bit storage locations probably means a bit mask. That means you have a number with 7 bits. All errors presumably would be `0b1111111` (which, if you plug that into a REPL, you'll see comes to 127). `bin(56)` produces `'0b111000'`, so you've probably got some errors. – Wayne Werner Jul 26 '16 at 02:42

0 Answers0