8 Programming with NanoJ
Tip
Nanotec recommends accessing a given OD value either by mapping or using a system call with
od_write()
. If both are used simultaneously, the system call has no effect.
8.1.5 NanoJ program – OD entries
The NanoJ program is controlled and configured in object range 2300
h
to 2330
h
OD-Index
Name and description
2300
h
2301
h
2302
h
2310
h
2310h NanoJ Input Data Selection
2320
h
2320h NanoJ Output Data Selection
2330
h
2330h NanoJ In/output Data Selection
Example:
To select and start the TEST1.USR user program, the following sequence can, for example, be used:
●
Rename file
TEST1.USR
with
vmmcode.usr
.
●
Copy file
vmmcode.usr
to the controller via USB.
●
Start the NanoJ program by writing object 2300
, bit 0 = "1" or by restarting the controller.
●
for error code and object 2301
h
, bit 0 = "1" (NanoJ program running).
Note
Due to limitations in the USB implementation, file "VMMCODE.USR" is, following a restart of the
controller, set to a size of 16 kB and the creation date set to 13.03.2012.
To stop a running program: write entry 2300
with bit 0 value = "0".
8.1.6 Structure of a NanoJ program
A user program consists of at least two instructions:
●
the preprocessor instruction
#include "wrapper.h"
●
the
void user(){}
function
The code to be executed can be stored in the
void user()
function.
Note
The file names of the user programs must not be longer than eight characters plus three characters
in the suffix; file name
main.cpp
is permissible, file name
aLongFileName.cpp
is not permissible.
Version: 2.0.1 / FIR-v1650
97