
— 21 —
VIII. Programming the Device
We have created a special programming language for the Device similar to common scripting languages.
There are number of limitations imposed by tasks and computing capabilities of the microcontroller.
Program consists of ASCII text, each line is either a statement, comment or blank line. Each new statement
must start on a new line. "Line breaks" are not supported. There is no special "statement terminator" symbol.
Programming language supports integers and rational numbers, positive and negative. Decimal separator
for rationals is dot. Hex numbers should be prefixed with 0x (x in lower case).
It is possible to use 7-bit ASCII symbols in single quotes (like 'a', '1'), they will be interpreted as corresponding
ASCII symbol number (ex.: 'a' == 97).
Reserved identifiers like constants (DATA, M_PI), interface identifiers (CAN1, CAN2), data type identifiers
(UINT32, FLOAT, etc.) must be entered in upper case.
Programming language supports only one user-defined function
func()
, also you can call built-in functions
get(), set(), cast(), send(), sin()
and others.
1. Defining filters
A filter is defined by the keyword
match()
with 3 parameters in parentheses and subprogram code in curly
brackets. Subprogram may be empty:
match(interface_id, filter, mask)
{
}
interface_id — the interface identifier: CAN1, CAN2 or ANY;
filter and mask — the numeric values of the filter and mask.
Formal match comparison expression for both hardware and software filters is:
if ( ( CAN_FRAME_ID AND mask ) == filter ) then MATCH else NO_MATCH