Lenze PLC Designer PLC Designer (R2-x) CANopen for Runtime Systems User Manual

Page 29

Advertising
background image

L-force | PLC Designer - CANopen for Runtime Systems

CANopen-Master library

28

DMS 2.0 EN 05/2009 TD29

If an object dictionary is available in the master, the master can act as a SDO server in the network.

Always when a client performs a writing access an object dictionary entry, the application will be
notified through the master flag bMsgUsed. This flag is implemented as an input variable of the master
so that the application can reset the flag. The master only sets the flag.

The application can use the object dictionary by directly writing or reading entries or by the
assignment of entries to IEC variables. In the latter case these IEC variables will be directly accessed
when reading or writing from/to another node.

An entry can be accessed as follows if index/subindex are known:

I := FindInODMEntries(16#iiiiss00, pCanOpenMaster[0].wODMFirstIdx,

pCanOpenMaster[0].wODMFirstIdx + pCanOpenMaster[0]. wODMCount;)

Therewith the index of the entry is available in I.

Now the components of the entry can be accessed directly:
For example: In order to get an entry directly pointing on an IEC variable, it is sufficient to
enter address, length and flags:
ODMEntries[I].dwContent := ADR(<variable name>);
ODMEntries[I].wLen := sizeof(<variable name>);
ODMEntries[I]. dwIdxSubIdxF := ODMEntries[I]. dwIdxSubIdxF OR OD_ENTRYFLG_WRITE
OR

OD_ENTRYFLG_ISPOINTER;

In order just to modify the content of the entry it is sufficient to modify dwContent.

Alternatively the following functions can be used, whereby always the index is to be set as input
parameter:

• GetODMEntryDataAddress, for accessing the address of the value of the entry.

• GetODMEntryDataLen, for evaluating the length of the data of the entry.

• GetODMEntryValue, for requesting the value of the entry.

• SetODMEntryValue, for setting the value of the entry.

Advertising