How To Use Lua In Remote Mode; How To Debug The Lua File - HMS Networks IXXAT CAN@net NT User Manual

Table of Contents

Advertisement

Using Lua ADK with the CAN NT Devices
3.3

How to Use Lua in Remote Mode?

Running the Lua script on the host PC and using it in remote mode can be used for example for
debugging. The recommend IDE is
The Ixxat Lua ADK includes the command line tool LuaADK.exe. This is a Lua interpreter v5.3
including a USB driver for the communication with the CAN@net/CANbridge NT device. This tool
has to be used instead of the Lua interpreter of the IDE.
To use the LuaADK.exe from ZeroBrane:
To open the user settings file, open menu Edit — Preferences — Settings: user.
Add the path to the LuaADK.exe (e.g. path.lua53 = 'C:\\Program Files\\HMS\
\IXXAT CAN-Gateway Configurator\\LuaADK.exe').
Open Project — Lua Interpreter and select Lua 5.3.
Restart ZeroBrane.
To communicate with the Target Device in Remote Mode
Make sure the CAN@net or CANbridge NT device is connected via USB.
Enable the use of the Lua ADK in remote mode (see
p.
7).
In the CAN-Gateway Configurator, open menu Target and select Write configuration to
target to write the device configuration to the connected CAN NT device.
Create a Lua script.
Note that the Lua script depends on the configuration on the target. For example, MQTT
broker settings must be configured on the target to be able to use the callbacks in the Lua
script.
Start the Lua script on the host PC.
LuaADK.exe reinitializes the device (connect device, test connection and load script).
Note that the target device only starts to operate, if the Lua script is started on the host PC.
Configure the target device from the Lua
If ZeroBrane stops at function initialize(), use Project — Continue to run the Lua
script or Project — Step over to single step the script line by line.
3.4

How to Debug the Lua File?

Lua is not able to detect set breakpoints, because functions like loop, initialize, and
are called from the C environment.
on_can
To be able to detect set breakpoints, add the following line to each function:
function loop(ticks, elapsed)
require('mobdebug').on()
-- my code
...
end
If this line is added, breakpoints can be set and single step debugging is possible.
Remove the line when using the code in target mode.
CAN@net NT/CANbridge NT User Manual
ZeroBrane
Studio.
How to Enable the Use of the Lua ADK?,
initialize
function and start normal operation.
-- <== Add this line at the beginning of
the function
9 (22)
4.02.0332.20002 1.2 en-US

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the IXXAT CAN@net NT and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Ixxat canbridge nt

Table of Contents