txrx? expect a reply and passes it on to the driver
txrx expect a reply and do not pass it on.
tx do not expect a reply.
HKJ,
I am running into an error when running a script that might have something to do with the above. The device is using ascii driver over a serial port and since it is a raw interface it uses txrx1Bin? and txrxnBin? communications commands. But there is no corresponding txrx1Bin without the question mark. So, for commands setting a value using txrx1Bin? with a ? a value is returned to the driver even though for a set we don't want a value returned. For example, there is the below scpiCmd definition for device write to the DPoles register:
#scpiCmd DPoles txrx1Bin? \x07\x(hex(limit(value/2,0,31)*8+3,2))
When I run scripts with the above type of set command in them a value is returned to the console. Sometimes that extra value incorrectly ends up in a variable. An example of this undesired value causing a script error is the below short script which comments out writing one value, reads one value from device S200, and prints the read value to the console.
=var temp = 0
;S200:DPoles 0
=temp = deviceRead("S200", "IuOffset?")
#delay 1
=temp
Running the above script the final value of temp on the last line correctly prints out the result of the "IuOffset?" query which should be a fixed value of -455.157. Below is the console result when running it:
=var temp = 0
=temp = deviceRead("S200", "IuOffset?")
#delay 1
=temp
;; -455.157
Uncommenting out the value set command to a completely un-related device parameter (S200:DPoles 0) right before the read command the result of the final print of temp should not change.
=var temp = 0
S200:DPoles 0
=temp = deviceRead("S200", "IuOffset?")
#delay 1
;;-455.157
=temp
;; 214
However the final value does change which is incorrect behavior.
I wonder if the root cause of this error is using txrx1Bin? for the parameter set? The txrx1Bin? command does return a value to the driver and it looks like that returned value is messing with the script.
How to emulate the functionality of txrx1Bin with no question mark to have no returned value for a set command? Using just txrx doesn't send the two hex values needed. For example txrx \x07\x00 sends those ascii characters and not the two hex values according to the DOS debug window.
;; COM1: Tx: <\x07\x00> 5C 78 30 37 5C 78 30 30
Trying txrx1Bin \x07\x00 with no "?" just sends those characters.
;; S200: Tx <txrx1Bin \x07\x00>
I did the above with the latest Ver 1.70. But, a couple of older versions also produce these same errors.