1 module canopendevice, Module canopendevice – Lenze PLC Designer PLC Designer (R2-x) CANopen for Runtime Systems User Manual

Page 39

Advertising
background image

L-force | PLC Designer - CANopen for Runtime Systems

CanDevice

38

DMS 2.0 EN 05/2009 TD29

3.6 Working with the CanDevice in the application program

3.6.1 Module CanopenDevice

The module is instanced once for each configured CanDevice. The components of the function block
are used as follows:

bAutoStart : BOOL;

Setting of option “Automatic startup”

ucNodeId : BYTE;

Node-ID of the CanDevice.

wDrvNr : WORD;

Index of the CAN controller in the configuration.

wODStart : WORD;

Index of the first object dictionary entry of the
CanDevice.

wODEnd : WORD;

Index of the last object dictionary entry of the
CanDevice.

wPDOStartRx : WORD;

Index of the first Rx-PDOs of the CanDevice within the
array of RxPDOs (pCanDevPDO_Rx).

wPDOCountRx : WORD;

Number of RxPDOs of the CanDevice.

wPDOCountRxCurMap : WORD;

Running variable for the configuration of the PDO
Mappings of the object dictionary.

wPDOStartTx : WORD;

Index of the first Tx-PDOs of the CanDevice within the
array of TxPDOs (pCanDevPDO_Tx).

wPDOCountTx : WORD;

Number of TxPDOs of the CanDevice.

wPDOCountTxCurMap : WORD;

Running variable for the configuration of the PDO
Mappings of the object dictionary.

ucNodeIdNew : BYTE;

This variable is set by init-code as follows: After calling
the CAN driver function CanInit, in which the driver can
set a new NodeID, e.g. from a rotary switch, this
variable gets assigned the value:
WORD_TO_BYTE(gCanInterface[1].pArray[1]) . Thus
CAN drivers must write a new NodeID in pArray[1].

ErrorCode : WORD;

If the application wants to send an emergency
message, here the input parameter ErrorCode
(according to CANopen) of function block
SEND_EMERGENCY is entered.

ErrorRegister : BYTE;

Like ErrorCode.

ManufacturerErrorField : ARRAY[0..4] OF BYTE; Analogue to ErrorCode.
bEmergencySent : BOOL;

Always when an emergency message has been sent,
this variable is set TRUE.bClearResetFlags : BOOL;
The application can set this flag to reset the flags that
show the reception of reset-NMT-messages.

bClearODEntryWritten : BOOL;

The application can set this flag to reset the flags that
show write access to the object dictionary.

bInit: BOOL;

Used to detect the first cycle.

bMsgUsed : BOOL;

Internal variable, always set when a device message
was used by the device.

bUseOldBootupToo : BOOL;

Flag, which can be set by the application in the first
cycle in order to cause the device to send also the old
bootup message (emergency with 0 bytes data length).

bGuardError: BOOL;

Set by the library if no guard message has arrived
within a time span of GuardTime * LifeTimeFactor.

ucState: BYTE := 127;

Current status of the device, according to CANopen.

Advertising