EasyManua.ls Logo

IFM Electronic CR0451 - Page 158

IFM Electronic CR0451
263 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
158
ifm System Manual ecomatmobile BasicDisplay (CR0451) V01
CAN in the PDM360 CAN POUs to CANopen
Access to the status of the CANopen master
8038
You should poll the status of the master so that the application code is not processed before the IO
network is ready. The following code fragment example shows one option:
Variable declaration
VAR
FB_MasterStatus := CANOPEN_GETSTATE;
:
END_VAR
program code
If FB_MasterStatus.MASTERSTATE = 5 THEN
<application code>
END_IF
By setting a value to the input NODEID of CANOPEN_GETSTATE the application can react and, for
example, jump the non configurable node.
The object directory of the CANopen master
8039
In some cases it is helpful if the CAN master has its own object directory. This enables, for example,
the exchange of data of the application with other CAN nodes.
The object directory of the master is generated using an EDS file named
CRnnnnMasterODEntry.EDS during compilation and is given default values. This EDS file is stored
in the directory CoDeSys Vn\Library\PLCconf. The content of the EDS file can be viewed via the
button [EDS...] in the configuration window [CAN parameters].
Even if the object directory is not available, the master can be used without restrictions.
The object directory is accessed by the application via function blocks:
- CANOPEN_GETODCHANGEDFLAG (→ page 202
),
- CANOPEN_READOBJECTDICT (→ page 203
),
- CANOPEN_WRITEOBJECTDICT (→ page 205
).
On the platform CoDeSys has no editor for this object directory.
The EDS file only determines the objects used to create the object directory.
If an object directory is available in the master, the master can act as SDO server in the network.
Whenever a client accesses an entry of the object directory by writing, this is indicated to the
application via the flag ODCHANGED in CANOPEN_GETODCHANGEDFLAG. After evaluation this
flag must be reset by the input RESETFLAG=TRUE.
The application can use the object directory by directly writing to or reading the entries.

Table of Contents