User Manual

MCP Series
Brushed DC Motor Controllers
MCP Series User Manual
148
DEC
DEC{#max} expression{\#min}
#max: optional maximum number of digits to send
#min: optional minimum number of digits to send
The DEC modier when used in an output command will convert a 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 1234.
temp var word
temp = 1234
puts 0, [DEC temp] ;prints “1234”
DEC(#max) variable
#max: optional maximum number of digits to receive
The DEC modier for input commands will format incoming ASCII characters into a numeric
value. The example will read in ASCII characters that represent decimal numbers up to 9
characters long and store the converted value in a variable. Until a numeral is received (e.g. “0”
to “9”) any incoming characters are ignored. Once a numeral has been received any character
not a numeral will cause the conversion to nish before 9 characters have been received.
temp var word
puts 0, [DEC temp]