Smart programming with LUA scripting language

AnaGate application programming extended with simple scripting interface

Karlsruhe. October 2010.

Analytica GmbH now provides a fast and intuitive scripting interface to create individual applications for control of devices of the AnaGate product line.

Scripts are created and edited on a pc in a common text editor (like notepad) and then just executed with a cost-free LUA interpreter in the command shell. The full standard functionality of LUA can be used as well as additional functional extensions for access of the AnaGate hardware ( see AnaGate Programmer's Manual, Part II: LUA-Scripting for detailed description).

LUA is a small and robust scripting language, which is very well suited for embedded systems. This particular feature can be used on all AnaGate devices with linux operating system (like AnaGate CAN uno/duo/quattro/USB): scripts can be easily loaded on the device via the web interface and can be locally executed.

See the following LUA code sniplet as code example:

aSendData = { 9xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 9xF8 };
nCANId    = 0x1000;

nRC, nHandle = LS_CANOpenDevice( false, true, 0, "192.168.1.254", 5000); 
nRC = LS_CANSetGlobals( nHandle, 500000, 0, true, false, false);  

nRC = LS_CANWrite( nHandle, nCANId, 8, sSendData );  

LS_CANCloseDevice(hHandle);

1

establish a connection to an AnaGate CAN at ip address 192.168.1.254

2

set CAN baud rate to 500 kBit

3

send a CAN telegram with CAN-ID 0x1000

Please contact us, if you need further information about LUA and our gateways.

Find Us
Language
English Deutsch