Page 1 of 1

MCL example

Posted: Mon Sep 09, 2019 6:15 am
by fausto.tromba
Hi
I struggle to understand MLC Editor.
Is it possible to send some comands (for example read the temperature) from MCL?

Thanks

Fausto

Re: MCL example

Posted: Mon Sep 09, 2019 10:16 am
by Basicmicro Support
There is an example in the manual. This is cut line for line from the manual

Code: Select all

main
	puts 0,[real TOFLOAT SYSTEMP/10.0\2,13]
	pause 100
	goto main
The puts command sends serial data to a port. In this case 0 which is the USB port.
The SYSTEMP variable holds the current board temperature in .1 degree counts(eg 250 = 25.0 degrees C).
The TOFLOAT function converts the SYSTEMP value into a floating point number which is then divided by 10.0.
The real modifier tells the puts command to output the value of the expression as ascii characters(eg "25.000000" assuming its 25C). The \2 tells the real modifier you only want 2 decimal places shown(eg "25.00"). The 13 is the decimal value for a carriage return.
Pause 100 pauses the script for 100milliseconds
Goto main jumps back to the "main" label causing the script to repeat infinitely.