Taking the #verifyDevice out allowed progress using the #driver Block. I can now read raw values from the device. But, I can't seem to do any :readmath" on the returned value.
Below is the stub device file with two #scpiCmd's defined and :readmath:'s commented out. These #scpiCmd's with :readmath: commented out return decimal numbers interpreting the returned serial byte as a signed 8 bit integer that are correct.
#idString "S200"
#name Kollmorgen S200 Servo
#handle S200
#port com
#comfixedbaud
; 19200 baud, Odd parity, 8 data bits, 1 stop bit
#baudrate 19200O81
#driver Block
#author gby
#scpiCmd HsTemp? txrx1? 0x4c 0x00
;:readmath: poly(value,-50.0,1.4775)
#scpiCmd Model? txrx1? 0x04 0x00
;:readmath: (0xF8&value)
If I un-comment either :readmath: line I get Java errors and Rx timeout. The HsTemp with :readmath: command gives:
;; S200: Tx <HsTemp?>
;; S200: Tx <txrx1? 0x4c 0x00
:readmath: poly>
java.lang.NumberFormatException: For input string: "00
:readmath:"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at dk.hkj.util.StringUtil.parseInt(StringUtil.java:531)
plus a bunch more java error lines. The Model? command gives a slightly different java error:
;; S200: Tx <Model?>
dk.hkj.script.ProgramExceptions$OperationNotSupportedForDataTypeException: BitAnd
0xF8&value____<----____
at dk.hkj.script.Script.parseBitOp(Script.java:351)
Further confusing me, if I leave the readmath commented out and run the following script lines it works fine.
=var temp=0
=temp = deviceRead("S200", "HsTemp?")
=temp = poly(temp,-50, 1.4775)
=temp
So, how to successfully do :readmath: with #driver Block in the #scpiCmd's?