1

I have a Temperature controller that I can communicate with it via USB, you have two types of commands, getters and setters. Commands such as B2 will get the current fan mode, expected response either 0 or 1. Command b2 will set the fan mode, according to the documentation b2 1 CR should set the fan to mode 1, but I get the following response 0x11. According to the doc, this means that the command was received, but the termination char is wrong. All possible termination chars are (NULL, #, CR, LF).

Examples

Fan 1 Mode

# getter
command: B2
response: 0x00
# setter
command: b2 1 CR
response: 0x11

Sensor 1 Temperature limits

# getter
command: G1
response: 0xffffb1e00001869f
# setter
command:g1 -20 000 120 000 CR
response: 0x11

I'm using PyVISA which is a frontend to the VISA library. I have looked into the code of pyvisa to see if it adds anything or modifies the commands that I write but couldn't find anything like that. I have tried all termination char (NULL, #, CR, LF). Could it be that pyvisa is doing something in the background that changes the commands ? Or what's happening here ?

I have made a python script to test out commands.

import pyvisa
import threading

def listen(keithley):    
    while True:
        if keithley.bytes_in_buffer >= 1:
            out = ''
            out = keithley.read_bytes(keithley.bytes_in_buffer).hex()
            print(out + '\n')

if __name__ == '__main__':
    rm = pyvisa.ResourceManager()
    keithley = rm.open_resource("ASRL5::INSTR")
    threading.Thread(target=listen, args=(keithley,)).start()
    print('Enter your commands below.\r\nInsert "quit" to leave the application.')
    print("Main    : start receiver")
    while True:
        data = input(">> ")
        if data == "quit":
            keithley.before_close()
            keithley.close()
            quit()
        else:
            keithley.write(data)
Achilles
  • 51
  • 5

0 Answers0