CANopen
A CAN-based communication system. It comprises higher-layer protocols and profile specifications. CANopen has been developed as a standardized embedded network with highly flexible configuration capabilities. Operations for IEC
See also: IEC 61131 Language Editor Programming
See also: Project Toolbox for IEC
Topic Menu
SDO Write
This element is used to change given object dictionary entry or to change the OCS register contents. If node is Master then using this block an object dictionary entry of any slave node in the network can be modified. In case of Slave only own object dictionary entries can be modified.
Inputs
EN – (Type: BOOL Boolean- [Data Type BOOL] - A single bit, binary value, or register/variable. Boolean points have only two possible values, 'TRUE' or 'FALSE'.) - The "EN" input is a condition. If EN is TRUE State then block is executed.
CB[] - (Type: INT Integer - [Data Type INT] - A 16-bit signed value. Integers are used where the value of the data is expected to be in the range of -32,768 to +32,767.[]) - This input is specified as register type and offset reference. This register is the first of five (5) registers that contain the information for the SDO write CAN message.
Word 1 Node ID Usually refers to the ID of the device on a supported CAN, such as CsCAN, CANopen, etc. Each device must have a unique network ID. Also called Node ID. – Node ID of the device (1 to 127) in case of Master only. For accessing the object dictionary / OCS register contents for self node, value 0 needs to be used.
Word 2 Index Value – Any valid 16-bit address to access the CANopen dictionary supported by the node; for array and records the address is extended by an 8-bit sub-index.
Word 3 Sub-Index Value – Any valid 8-bit sub-address to access the sub-objects of arrays and records supported by the node.
Word 4 Data Length - Amount of data to write (Max data length can be 4 bytes).
Word 5 Start of Data - Any valid Register address.
Outputs
CBO[] - (Type: INT[])
Output is specified as a Register Type and Offset reference. This register is the first of three (3) registers that contain the information of output data.
Word 1 Kernel Error – Gives value of Kernel Error. NOTE: For Kernel Error and SDO Error tables, see Error Details.
Word 2 SDO Error – SDO Error (Higher 16 bits)
Word 3 SDO Error – SDO Error (Lower 16 bits)
ST Language
(*Inst_CANopenSDOWRITE is a declared instance of SDO Write Block*)
Inst_CANopenSDOWRITE(EN1, CB, CBO);
FBD Language
LD Language
IL Language
Return to the Top: CANopen Operations for IEC
SDO Read
This element reads the given object dictionary entry or the OCS register contents. If node is Master then using this block an object dictionary entry of any slave node in the network can be read. In case of Slave only own object dictionary entries can be read.
Inputs
EN – (Type: BOOL Boolean- [Data Type BOOL] - A single bit, binary value, or register/variable. Boolean points have only two possible values, 'TRUE' or 'FALSE'.) - The "EN" input is a condition. If EN is TRUE State then block is executed.
CB[] - (Type: INT Integer - [Data Type INT] - A 16-bit signed value. Integers are used where the value of the data is expected to be in the range of -32,768 to +32,767.[]) - This input is specified as register type and offset reference. This register is the first of three (3) registers that contain the information for the SDO read CAN message.
Word 1 Node ID Usually refers to the ID of the device on a supported CAN, such as CsCAN, CANopen, etc. Each device must have a unique network ID. Also called Node ID. – Node ID of the device (1 to 127) in case of Master only. For accessing the object dictionary / OCS register contents for self node, value 0 needs to be used.
Word 2 Index Value - Any valid 16-bit address to access the CANopen dictionary supported by the node; for array and records the address is extended by an 8-bit sub-index.
Word 3 Sub-Index Value - Any valid 8-bit sub-address to access the sub-objects of arrays and records supported by the node.
Outputs
CBO[] - (Type: INT Integer - [Data Type INT] - A 16-bit signed value. Integers are used where the value of the data is expected to be in the range of -32,768 to +32,767.[]) - Output is specified as a Register Type and Offset reference. This register is the first of five (5) registers that contain the information of output data.
Word 1 Kernel Error – Gives value of Kernel Error. NOTE: For Kernel Error and SDO Error tables, see Error Details.
Word 2 SDO Error – SDO Error (Higher 16 bits)
Word 3 SDO Error – SDO Error (Lower 16 bits)
Word 4 Data Length – Amount of data to read (Max data length can be 4 bytes)
Word 5 Start of Data – Any valid Register address
ST Language
(*Inst_CANopenSDOREAD is a declared instance of SDO Read Block*)
Inst_CANopenSDOREAD( ENr, CBR, CBOR );
FBD Language
LD Language
IL Language
Return to the Top: CANopen Operations for IEC
Get Local ID
This element reads the local CANopen node ID Usually refers to the ID of the device on a supported CAN, such as CsCAN, CANopen, etc. Each device must have a unique network ID. Also called Node ID.. Enabling the input power to this element gets the Local Node ID in the configured register.
ST Language
(*Inst_CANopenGETLOCID is a declared instance of Get Local ID Block*)
Inst_CANopenGETLOCID( ENL1 );
FBD Language
LD Language
IL Language
Return to the Top: CANopen Operations for IEC
Get NMT State
This element reads the local or slave node CANopen NMT state.
Inputs
EN – (Type: BOOL Boolean- [Data Type BOOL] - A single bit, binary value, or register/variable. Boolean points have only two possible values, 'TRUE' or 'FALSE'.) - The "EN" input is a condition. If EN is TRUE State then block is executed.
NodeID - (Type: INT Integer - [Data Type INT] - A 16-bit signed value. Integers are used where the value of the data is expected to be in the range of -32,768 to +32,767.) - Node ID of the device for which NMT state needs to be obtained. For accessing the NMT state of self node, value 0 needs to be used.
Outputs
NMT State - (Type: INT) - Gives the NMT state of the device.
NOTE: Following are the possible NMT states and their values in Hex A base-16 numbering system which uses the symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F for numeral.:
NMT State | Value in Hex |
---|---|
Preoperational | 7F |
Operational | 5 |
Stop | 4 |
ST Language
(*Inst_CANopenGETSTATE is a declared instance of Get NMT State Block*)
Inst_CANopenGETSTATE( ENN1, NodeID_ST );
FBD Language
LD Language
IL Language
Return to the Top: CANopen Operations for IEC
Set NMT State
This element sets NMT state of given node in the CANopen network. This block can only be used if node is configured as Master.
Inputs
EN – (Type: BOOL Boolean- [Data Type BOOL] - A single bit, binary value, or register/variable. Boolean points have only two possible values, 'TRUE' or 'FALSE'.) - The "EN" input is a condition. If EN is TRUE State then block is executed.
CB[] - (Type: INT Integer - [Data Type INT] - A 16-bit signed value. Integers are used where the value of the data is expected to be in the range of -32,768 to +32,767.[]) - This input is specified as register type and offset reference. This register is the first of two (2) registers that contain the information of input data.
Word1 Node ID Usually refers to the ID of the device on a supported CAN, such as CsCAN, CANopen, etc. Each device must have a unique network ID. Also called Node ID. - Node ID of the device. For setting the NMT state of self node, value 0 needs to be used.
Word 2 NMT State – NMT command of corresponding NMT State.
NOTE: Following are the NMT commands for corresponding NMT states:
States | NMT Commands |
---|---|
Pre-operational | 80 |
Operational | 1 |
Stop | 2 |
Reset Comm | 81 |
Rest Node | 82 |
Outputs
KernelError - (Type: INT) - Indicates any kernel error. NOTE: For Kernel Error, emergency messages and codes and error registers, see Error Details.
ST Language
(*Inst_CANopenSETNMT is a declared instance of Set NMT State Block*)
Inst_CANopenSETNMT( ENS, CBS );
FBD Language
LD Language
IL Language
Return to the Top: CANopen Operations for IEC
Receive Emergency Message From a Given Device
This element is used to receive emergency message from specific device.
Inputs
EN – (Type: BOOL Boolean- [Data Type BOOL] - A single bit, binary value, or register/variable. Boolean points have only two possible values, 'TRUE' or 'FALSE'.) - The "EN" input is a condition. If EN is TRUE State then block is executed.
NodeID - (Type: INT Integer - [Data Type INT] - A 16-bit signed value. Integers are used where the value of the data is expected to be in the range of -32,768 to +32,767.) - Node ID of the device for which emergency message needs to be received
Outputs
CBO[] - (Type: INT[]) - Output is specified as a Register Type and Offset reference. This register is the first of five (5) registers that contain the information of output data.
Word1 Kernel error – Gives value of Kernel Error. NOTE: For Kernel Error, emergency messages and codes and error registers, see Error Details.
Word2 EMC Value in 64 bit – Gives the emergency message/codes.
Word3 – Lower 8 bit represents Error Register and upper 8 Bit Manufacturer specific error field.
Word4 – Higher 16 bits of Manufacturer specific error.
Word5 – Lower 16 bits of Manufacturer specific error.
ST Language
(*Inst_CANopenRCEMCDEV is a declared instance of Receive Emergency Message from a given Device Block*)
Inst_CANopenRCEMCDEV( EN_ST, Node_ST, CBO_ST );
FBD Language
LD Language
IL Language
Return to the Top: CANopen Operations for IEC
Receive Emergency Message From Any Device
This element is used to receive emergency message from any device in the network.
Inputs
The "EN" input is a condition. If EN is TRUE State then block is executed.
Outputs
CBO[] - (Type: INT Integer - [Data Type INT] - A 16-bit signed value. Integers are used where the value of the data is expected to be in the range of -32,768 to +32,767.[])
Output is specified as a Register Type and Offset reference. This register is the first of Six (6) registers that contain the information of output data.
Word1 Kernel Error – Gives value of Kernel Error. NOTE: For Kernel Error, emergency messages and codes and error registers, see Error Details.
Word2 NodeID – Device Node ID.
Word3 EMC Value in 64 bit – Indicates the emergency message/codes.
Word4 – Lower 8 bit represents Error register and upper 8 Bit Manufacturer specific error field.
Word5 – Higher 16 bits of Manufacturer specific error.
Word6 – Lower 16 bits of Manufacturer specific error.
Note: Manufacturer specific error field represents Horner CANopen Status register contents.
ST Language
(*Inst_CANopenRCEMC is a declared instance of Receive Emergency Message from any Device Block*)
Inst_CANopenRCEMC( EN_ST1, CBO_ST1 );
FBD Language
LD Language
IL Language
Return to the Top: CANopen Operations for IEC
Error Details
Kernel Error
0x0 | No Kernel Error |
0x1 | Other Kernel Errors |
0x21 | SDO Engine is Busy |
0x22 | Memory Access Error |
0x23 | SDO Timeout Error |
0x24 | Not Supported |
0x25 | Emergency Busy Error |
0x26 | Input Data Error |
0xFE | Waiting for Response |
0xFF | Kernel Not Active |
SDO Error
0x5040002 | Invalid Block Size |
0x5040003 | Invalid Sequence Count |
0x6010000 | Index Not Supported. |
0x6010002 | Index Read Only |
0x6070012 | Data Length is high |
0x6070013 | Data Length is Low |
0x8000022 | Invalid NMT State |
0x6040041 | PDO Mapping Failed |
0x6040042 | PDO Length Exceeded |
0x6090011 | Sub Index Not Supported |
0x6090030 | Value Range Exceeded |
0x6040043 | Parameter Incompatible |
Error Register Bit Details
Bit |
MO |
Meaning |
0 |
M |
Generic Error |
1 |
O |
Current |
2 |
O |
Voltage |
3 |
O |
Temperature |
4 |
O |
Communication Error (overrun, error state) |
5 |
O |
Device Profile Specific |
6 |
O |
Reserved (always 0) |
7 |
O |
Manufacturer Specific |
Emergency Codes
Error Codes |
Meaning |
00xx |
Error Reset or No Error |
10xx |
Generic Error |
20xx |
Current |
21xx |
Current, device input side |
22xx |
Current inside the device |
23xx |
Current, device output side |
30xx |
Voltage |
31xx |
Mains Voltage |
32xx |
Voltage inside the device |
33xx |
Output Voltage |
40xx |
Temperature |
41xx |
Ambient Temperature |
42xx |
Device Temperature |
50xx |
Device Hardware |
60xx |
Device Software |
61xx |
Internal Software |
62xx |
User Software |
63xx |
Data Set |
70xx |
Additional Modules |
80xx |
Monitoring |
81xx |
Communication |
8110 |
CAN Overrun (Objects lost) |
8120 |
CAN in Error Passive Mode |
8130 |
Life Guard Error or Heartbeat Error |
8140 |
Recovered from bus off |
8150 |
Transmit COB-ID collision |
82xx |
Protocol Error |
8210 |
PDO not processed due to length error |
8220 |
PDO length exceeded |
90xx |
External Error |
FOxx |
Additional Functions |
FFxx |
Device Specific |
Return to the Top: CANopen Operations for IEC