2017-03-02 57 views
0

所以我试图通过串行(USB-A到USB-B)来控制Thermo Scientific温度浴,当我发送命令时,我得到响应“F001”告诉我该命令已知。格式为“命令”,“回车”,这里是我有:Python串行通信接收命令UNKNOWN

ser = serial.Serial('/dev/tty.usbserial-A800dars', 9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=5) #no timeout=0 
print(ser.name)       # check which port was really used 

ser.write(b'RT\r')      # read internal temp 
# TODO probably not getting 100 bytes here, need to find what to expect and whether or not to do a timeout 
serial_response = ser.read(100)   # read up to one hundred bytes or as much is in the buffer 
print(serial_response) 

我已经尝试添加\ n中的\ R后,我已经试过多个其他命令,我已经包含了RT和\ r之间的空间,我已将温度槽上的波特率设置为与通过串行发送时相同。我也确定我从http://www.ftdichip.com/FTDrivers.htm使用了正确的驱动程序。

有什么想法?我正在使用Mac,通过USB-A发送到USB-B电缆,并且在温度浴开启并运行时,我只能得到F001响应。

回答

0

事实证明,我被制造商给了不正确的手册。找到正确的,现在知道正确的命令发送串行所有上面的代码工作得很好。