Lex

From Merlin Systems Wiki

Lex commands for v1.1



ii 2-digit decimal unit id (=comms address) c character nnn fixed-length decimal number {n} variable-length decimal output (can include '-' sign) XX hex number

general forms [00c...] send to all (broadcast), no-one can respond [iic...] send too unit='ii' only, it can respond [c...] send to unit=1 (short form address)

COMMANDS

cmd responses name function --- --------- ---- --------

[&] <id=nn> Cmd_CmdSetId read comms id [&={n}] <id=nn> change comms id (1..99) [v] <vsn=MX.XX> Cmd_CmdVersion show software version [`] Reboot cpu reset (like POR) [X] <0xXXXX> Calc_Cmd_ReadHex reading output, hex value [?] <{n}.n> Calc_Cmd_ReadPos reading output /10 output as 1DP (?!not very good?!) [={n}] <ii:{n}.n> Calc_Cmd_Cont repeating output (like [?]) [.c] <c=0xXXXX> Eevar_Cmd_EeParam read single ee param (hex only) [.c=XXXX] <c=0xXXXX> write single ee param (hex only) [^] <c=0xXXXX><c=0xXXXX>... Eevar_Cmd_DumpParams show all params


parameter set

=

char name default-value use


---- ------------- ---

G ee_G 0x43E5 calc main gain i ee_i 0x003B calc input offset o ee_o 0xFE60 calc output offset C ee_Cont 0 continuous output from reboot (n=initial rate, 0=off) b ee_Baud 192 baudrate/100 (allowed=12,24,48,96,192,384,576,1152)

  1. ee_Ser 0 serial number

(extras - not general use

v       ee_Avshift      0x0002                  input averaging rate (t=1/2**n) (trace value only for now)
r       ee_CalcRate     25=0x1b                 calculation rate = 40/sec

)


NOTES

=

output calculation is = ('G'*16)/(VV+'i')+'o', where VV=sensor input measurement (0..3FF nominal range) if baudrate is not a valid number, defaults to 4800 (which is _not_ the parameter default)


Quick tests

=

Alive


[v] shows firmware version

    • if id=1**, "[t]" gives test response

- when id set <> 1, needs id for an response at all, e.g. [02t]

  • ALSO* if id=1, spits out version-string on startup

- useful with scope to debug comms problems

BAUDRATE


When first programmed, defaults to 19200. For snake, needs 38k4 If totally lost contact, you will have to reprogram (wipe the EE) -> back to unit=1, baud=19200

VALUE


[=] for continuous decimal value output, e.g. "[=250]" for 4-per-sec updates Note: the decimal point position is really arbitrary, but it's ok for the NTU length ones to readout in mm (except the resolution is not as good as 0.1mm throughout the range)