MCL example

Questions about using the MCL scripting language.
Post Reply
fausto.tromba
Posts: 37
Joined: Wed Jul 31, 2019 7:24 am
MCL example

Post 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
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: MCL example

Post 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.

Post Reply