User Manual

MCP Series
Brushed DC Motor Controllers
MCP Series User Manual
150
HEX
HEX{#max} expression{\#min}
#max: optional maximum number of digits to send
#min: optional minimum number of digits to send
The HEX modier, in output commands, converts stored values to ASCII characters. The example
will format the value of temp so it prints out the number in a terminal window. The output would
display 12ab.
temp var word
temp = 0x12ab
puts 0, [HEX temp] ;prints “0x12ab”
HEX(#max) variable
#max: optional maximum number of digits to receive
The HEX modier, for input commands, formats incoming ASCII characters into a numeric
value. The example will read in ASCII characters that represent hexidecimal numbers up to 8
characters long and store the converted value in a variable. Until a numeral is received (e.g. “0”
to “9” or “a” to “f”) any incoming characters are ignored. Once a numeral has been received
any character not a numeral will cause the conversion to nish before 8 characters have been
received.
temp var word
puts 0, [HEX temp]