User Manual

MCP Series
Brushed DC Motor Controllers
MCP Series User Manual
152
REAL
REAL{#maxint} expression{\#maxdec}
#maxint: optional maximum number of integer digits to send
#maxdec: optional maximum number of decimal point digits to send
The REAL 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 3.14159.
temp var oat
temp = 3.14159
puts 0, [REAL temp] ;prints “3.14159”
REAL variable
The REAL modier, for input commands, formats incoming ASCII characters into a numeric value.
The example will read in ASCII characters that represent oating point numbers and store the
converted value in a variable. Until a numeral is received 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 oat
puts 0, [REAL temp]
STR
STR array\length{\eol}
The STR modier will output Length amount of characters from specied constant or variable
array until the end of the array or until an optional specied EOL character is found.
temp var byte(20)
temp = “Hello world”,0
puts 0,[str temp\20\0] ;output “Hello world”
STR array\length{\eol}
The STR modier, in input commands, will receive Length number of characters and store them
in the variable array specied. An optional end of line (EOL) character can be specied to tell
STR to stop receiving characters.
temp var byte(20)
puts 0,[str temp\20\13] ; receive upto 20 characters