Block that allows monitoring various statuses of the CANopen network master.
Ladder Representation

Block Structure
Variable Type |
Name |
Data Type |
Description |
VAR_INPUT |
Execute |
BOOL |
Block enabling |
DisableComm |
BOOL |
Disables CANopen communication |
|
SendNMT |
BOOL |
Triggers management command sending |
|
NMTCommand |
BYTE |
Management command code to be sent |
|
NodeID |
BYTE USINT |
Slave address for sending the NMT |
|
VAR_OUTPUT |
Done |
BOOL |
Output enabling |
CommDisabled |
BOOL |
Disabled communication flag |
|
BusPowerOff |
BOOL |
Flag of a power failure of CAN interface |
|
BusOff |
BOOL |
Flag indicating BusOff error at the CAN interface |
|
NMTCmdFeedback |
BOOL |
Flag of NMT command sent by the master |
|
ErrorCtrlFailure |
BOOL |
Flag indicating error of nodeguarding or heartbeat in a slave network |
|
InitFailure |
BOOL |
Flag indicating error in the initialization of the slavee network |
|
InitFinished |
BOOL |
Flag indicating the initialization of the slaves was completed |
Operation
This block remains active while Execute is at TRUE level, updating its outputs according to the monitoring of the master and input requests. When Execute receives FALSE level, the inputs are ignored and the outputs are zeroed. The Done output receives TRUE level when Execute has TRUE level and block finished its execution.
A TRUE level DisableComm disables the CANopen communication and resets the status counters and markers of the master.
A leading edge on SendNMT sends a command management (NMT) indicated at NMTCommand to the slave of NodeID address.
Outputs receive TRUE level when the status of the CANopen master matches description (disabled communication, power failure, etc.).
Block Flowchart

Example in Ladder

The example above requests status data of the CANopen network master, and allows disabling communication through DISABLE and to send commands NMT to NODEID through SEND_COMM. The block ends successfully, Done output is activated.
Example in ST
The example below displays the instructions for applying the example above in the ST language.
VAR DISABLE, SEND_COMM, STATUS_DISABLED, STATUS_POWEROFF, STATUS_BUSOFF, STATUS_FB, STATUS_ERROR, STATUS_FAILURE, STATUS_FINISHED: BOOL; COMM, NODEID: BYTE; END_VAR
DO1 := FB_CO_MasterControlStatus( Execute:=DI1, DisableComm:=DISABLE, SendNMT:=SEND_COMM, NMTCommand:=COMM, NodeID:=NODEID, CommDisabled=>STATUS_DISABLED, BusPowerOff=>STATUS_POWEROFF, BusOff=>STATUS_BUSOFF, NMTCmdFeedback=>STATUS_FB, ErrorCtrlFailure=>STATUS_ERROR, InitFailure=>STATUS_FAILURE, InitFinished=>STATUS_FINISHED);
|
|---|