changeset 79:84f96c5fe791

Use different message ID that does not result in "Query UNTERMINATE" messages in the error log. Fix testsrq. Rename queryrsb to querystb as that matches the operating manual.
author Daniel O'Connor <doconnor@gsoft.com.au>
date Fri, 27 Sep 2024 16:53:43 +0930
parents 47da95b31dcb
children b280fe3b696a
files rsib.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rsib.py	Fri Sep 27 16:50:42 2024 +0930
+++ b/rsib.py	Fri Sep 27 16:53:43 2024 +0930
@@ -53,7 +53,7 @@
 # 01	00	?
 # 02	00	?
 # 03	05	Length
-# 04	90	MsgID
+# 04	94	MsgID
 # 05	00	?
 # 06	03	Seq number
 # 07	2a (*)	Cmd byte 0
@@ -65,6 +65,9 @@
 # Interactive program seems to cap length at 0x99 but perhaps the
 # first 4 bytes are length.
 #
+# MsgID is 0x94 but 0x90 works but then we get "Query UNTERMINATED"
+# from SYS:ERR? Could be EoM bit.
+#
 # Reply to command:
 # <- 00 00 00 23 80 00 01 52 6f 68 ...
 #
@@ -78,7 +81,6 @@
 # 06	01	Seq number
 
 MSG_HELLO = 0x40   # We send this on connect
-MSG_CMD = 0x90     # Command to the instrument
 MSG_SRQ = 0x91	   # Query SRQ
 
 import socket
@@ -122,7 +124,7 @@
 
         # Pre-increment for easy comparison in read
         self.tag = (self.tag + 1) & 0xff
-        msg = b'\x00\x00\x00' + bytes([len(cmd)]) + b'\x90\x00' + bytes([self.tag]) + cmd.encode('ascii')
+        msg = b'\x00\x00\x00' + bytes([len(cmd)]) + b'\x94\x00' + bytes([self.tag]) + cmd.encode('ascii')
         self.s1.send(msg)
 
     def read(self, timeout = 0.5):
@@ -177,7 +179,7 @@
         self.write(s)
         return self.read(timeout = timeout)
 
-    def queryrsb(self):
+    def querystb(self):
         msg = b'\x00\x00\x00\x00\xd1\x18\x00'
         self.s2.send(msg)
 
@@ -189,7 +191,7 @@
             reply += rx
 
         # '\x00\x00\x00\x00\x80\x04\x01' => STB = 4
-        if rx[4] != b'\x80':
+        if rx[4] != 0x80:
             raise IOError("Incorrect Msg ID in response to STB query")
 
         return rx[5]