1) Introduction
Nexto Xpress controllers contain a CAN bus interface compatible with CAN 2.0A and CAN 2.0B standards (11 and 29-bit identifiers). There are two traditional use cases for this interface:
• Use it with the CANopen Manager protocol, allowing the PLC to communicate with CANopen slave I/O devices (Feature available for the entire Xpress series, firmware version 1.8.5.0 or higher required).
• Use it with the CANopen Slave operating mode, allowing the PLC to be used as a non-programmed secondary I/O device.
In addition to these two standard use cases, there is a third (advanced) one:
• Use it for low-level CAN communication.
Low-level CAN communication allows transmitting/receiving raw CAN messages without using higher-layer protocols such as CANopen, J1939, etc. This can be useful for communicating with devices that use custom/specific CAN protocols. This use case works for all XP3xx models.
Low-level CAN communication is implemented by a group of CAA libraries (the same ones used by higher-layer protocols such as CANopen, J1939, etc.), which must be included in the application as described below:
The basic functions used for communication are located in the external low-level CAA Can library (namespace "CL2"):
Complete documentation can be found in the CODESYS Online Help:
2) Application Example
The following example consists of two XP300 controllers (PLC1 and PLC2). PLC1 sends a message called "123" (COB ID) containing a USINT (byte) element, which is received by PLC2 and moved to outputs Q00 to Q07.
The application was developed with MasterTool v3.17 in the structured text language, located in the POU UserPrg. The code is commented step by step, explaining the structure of the functions. To start the test, set the variable "bEnable" to TRUE for each application, which will configure the CAN network to 250 kbits/s and start communication.
Comments
0 comments
Please sign in to leave a comment.