![NANOTEC PD4-C5918M4204-E-01 Manual Download Page 76](http://html1.mh-extra.com/html/nanotec/pd4-c5918m4204-e-01/pd4-c5918m4204-e-01_manual_3241520076.webp)
Manual PD4-C (USB)
11 Programming with NanoJ
Version: 1.4.1 / 22.07.2016 / FIR-v1626
76
•
Direct reading and writing of object dictionary values via system calls
•
Calling up of other system calls (e.g. write debug output)
Via a PDO mapping, object dictionary values in the form of variables are made available to the user
program. Before a user program receives its 1-ms time slot, the firmware transfer the values for this
from the object dictionary to the variables of the user program. When the user program now receives
computing time, it can manipulate these variables like the usual C variables. At the end of the time slot,
the new values are automatically copied into the respective object dictionary entries by the firmware.
To optimize the performance, 3 types of mappings are defined: Input, output and input/output (In, Out,
InOut). Input mappings can only be read and are not transferred back into the OD. Output mappings
can only be written. Input/Output Mappings, on the other hand, permit reading and writing.
The set mappings can be read out and checked via the web interface at objects 2310
h
, 2320
, and
. For each mapping, a maximum of 16 entries is allowed.
The specification of the linker section is used to control in NanoJ Easy whether a variable is stored the
under input, output, or data range.
11.3.2 Execution of a VMM cycle
In summary, the procedure for the execution of a VMM cycle with respect to the PDO mapping consists
of the following three steps:
1. Read values from the object directory and copy them into the Inputs and Outputs areas.
2. Execute the user program.
3. Copy values from the Outputs and Inputs areas back to the object directory.
The configuration of the copy procedures is in line with the CANopen standard.
In addition, it is also possible to access system calls via the object directory. In general, this is
considerably slower and therefore mappings should be given preference. However, the number of
mappings is limited (16 entries each in In/Out/InOut). Therefore, it is advisable to map frequently-used
and changed object dictionary values and to access less frequently used object dictionary entries by
system call. A list of available system calls can be found in the "System calls" section.
Note
It is strongly advised to access one single object dictionary value either by mapping or system call
with
od_write()
. If both are used at the same time, system call will not have any effect.
11.3.3 Saving of data
!
WARNING
Make sure, that the controller is in state "Switch on disabled" at the start of the saving and during the
saving process.
CAUTION
The memory is able to support a certain amount of writing cycles, after that, the memory is damaged.
Make sure to keep the amount of writings as low as possible.
For persisting data permanently from within NanoJ there is a special object available: 2700
. The
subindices have the following meanings:
•
01
h
: If the value "1" is written in this sub-index, the subindices 02
h
to 09
h
are getting saved. When
the process has finished, the value "0" is put in this sub-index.
•
02
h
to 09
h
: In those subindices data can get deposited for saving. At a start or restart of the
controller the data will get loaded again.