This documentation describes how a customized object can be programmed.
| || |
You need LoxoneConfig 2.1 onwards for using PicoC-Scripts in the configuration-software. Please check out our newest beta-releases for using the scripts.
The programming language PicoC (http://code.google.com/p/picoc/) is used. PicoC is a very small C interpreter for scripting. It was originally written for scripting a UAV's on-board flight system and it's also very suitable for other robotic, embedded and non-embedded applications too.
- Note that the complete C specification can not be met!
- The program code is interpreted. Therefore keep the code as low as possible. Avoid complex program structures.
- Each program runs in a separate task, therefore, asynchronous to the SPS.
- Outputs with printf will be written to the log window of Loxone Config.
- Note also that with an own programming, the system can be lead to crash. Program your instructions carefully. In case of emergency an SD card must be created, so the system gets operational again.
- If you want to run the program indefinitely, add in the program loops implicitly a sleep- function so that the program does not consume unnecessary CPU time.
- An integer has 32 bits, little endian.
- 128kB are available for heap and stack. Use memory thrifty; do not forget to release memory.
- All functions which return a pointer must reallocate the memory with free (), unless the pointer was passed as a parameter.
- Time values are indicated in seconds since 1.1.2009 0 UTC clock.
- Strings are encoded in UTF-8.
- Use mathematical function sparsely - the processor in the Miniserver has no mathematical hardware unit.
There are program objects with 1, 4, 8 and 16 inputs and outputs. You can insert a program-object by chosing it under "General" in the tab "Program".
Each program also has an error output (TeQ), where eventual interpreter- error messages are released. This allows the detection of syntax errors.
The program code can be edited by double-clicking on the program- object.