User Manual
MCP Series
Brushed DC Motor Controllers
MCP Series User Manual
149
SDEC
SDEC{#max} expression{\#min}
#max: optional maximum number of digits to send
#min: optional minimum number of digits to send
The SDEC modier 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 sword
temp = -1234
puts 0, [SDEC temp] ;prints “-1234”
SDEC(#max) variable
#max: optional maximum number of digits to receive
The SDEC modier 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 negative sign or 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 sword
puts 0, [SDEC temp]