skesh
New Member
Posts: 2
|
Post by skesh on Jul 9, 2024 3:51:20 GMT -5
I am trying to connect to the controller using RS-232 serial port. I am using python to connect. The aim of the project is to read temperature from the controller and save it as metadata with other instruments in my lab. I was able to connect and send the message on serial port, but the reply I get is strangely encoded and does not match the manual.
>> ser = serial.Serial('/dev/ttyUSB1') # Serial Device >> mess = "*IDN?\r\n" # Query for identification >> ser.write(mess.encode()) # Send Query >> ser.read(30) # Receive the message
The Message I receive is:
b'L\xd3CI,\xcdO\xc4EL\xb32\xb5,L\xd3\xc127\xb0\xc8,1\xae8/1\xae1\r'
According to the manual, I should get:
LSCI,MODEL325,1234567,1.0/1.0
For some reason, I am not getting correct ASCII bytes for 'S', 'M', 'D' and so on. ASCII for 'S' is \x53, and the ASCII which I get is \xd3, which is exactly 128 more than 'S'. This pattern follow for all the characters I get. If I get a hex valve which is more than 128, I can just substract 128 from the byte and I get the correct byte. Actually, 128 is also biggest 8 bit integer (2^(8-1)).
If I run the simple algorithm that if byte is more than 128. subtract 128 and print it, I get LSCI,MODEL325,LSA270H,1.8/1.1
I am not sure if the bug is in python or in the firmware of instrument. Any help would be appreciated.
|
|
skesh
New Member
Posts: 2
|
Post by skesh on Jul 9, 2024 4:37:30 GMT -5
Quick Update: I think I fixed the problem. I should have read the manual more carefully. You need to set the data to be 7 bits and set a stop and parity bit. If done like that, it works nicely.
|
|
|
Post by Lake Shore Jeff M on Jul 9, 2024 6:38:30 GMT -5
You made the correct changes to the RS232 settings. The complete RS232 parameters are defined in section 6.2.2 of the Model 325 User Manual.
|
|