Click the blue text
Follow us
Sometimes we follow many public account messages and miss some of our favorite messages, unable to see the Industrial Control Forum’s push in time. We can star or pin the public account. So how to star and pin it? 【Open an article from the Industrial Control Forum public account, click the blue text below the article title to enter the Industrial Control Forum public account, select “Set as Star” in the upper right corner “···” to pin the public account】
1. Experiment Overview
In industrial automation applications, CANopen is a high-level communication protocol based on the Controller Area Network (CAN), including communication sub-protocols and device sub-protocols, commonly used in embedded systems, and is also a commonly used fieldbus in industrial control.
Control Expert is a comprehensive programming, debugging, and operating software. It is powerful yet intuitive, highly integrated and open, making it an ideal partner for improving productivity. The Control Expert software can be used in M580, M340, Quantum, and other series of PLCs, providing complete freedom to choose the best solution for your applications and enjoy the benefits of full portability between PLCs.
The M580 series CPU does not have a built-in CANopen port like the M340 series CPU; it must use the CANopen X80 master station module (BMECXM0100) to achieve CANopen communication on the M580 PAC. The hardware catalog only has one device part number BMECXM0100 to declare and configure two types of CANopen X80 master station module references, protocol standard CANopen CiA 301 V4.2. It supports remote slave stations on the M580 Ethernet backplane (with the slave communication device BMECRA31210 module, minimum firmware version V2.10), but this CANopen module cannot be configured on Quantum X80 stations.
Wachendorff is a well-known German manufacturer of encoders, measurement systems, and industrial instruments, headquartered in Geisenheim, a small town west of Wiesbaden in the Rhine-Hesse region of Germany. Since its establishment in 1978, it has focused on encoder technology research and development for nearly 40 years. All products are made in Germany, providing diverse and personalized high-quality product customization services to global customers for decades. The WDGA 58B CANopen encoder with current isolation, CANopen WDGA 58B, with current isolation; solid shaft encoder, clamping flange, housing: Ø 58mm, 16-bit/43-bit single-turn/multi-turn; shaft: Ø 6mm, Ø 8mm, Ø 10mm, Ø 3/8″, following CiA 301 communication protocol, encoder CiA 406 V3.2 Class C2 device protocol; binary code.
2. Experimental Components
Main hardware is shown in the table:
Type |
Model |
Quantity |
Reference Image |
PLC |
BMEP582040 |
1 |
|
CANopen X80 Master Station Module |
BMECXM0100 |
1 |
|
CANopen Encoder |
WDGA 58B-10-1212-COA-B00-CB5-AAS |
1 |
|
Main software is shown in the table:
Software |
Description |
Reference Image |
Control Expert V15 |
Schneider ElectricM580 PLC configuration and programming software. |
|
Hardware configuration is shown in Figure 2.1 and Figure 2.2:
Figure 2.1
Figure 2.2
3. Software Configuration and Program Writing
3.1 BMECXM0100 Configuration
Open the Control Expert software, create a new project, select the rack, and configure the power supply BMXCPS3500, CPU BMEP582040, and CANopen X80 master station module BMECXM0100 module. Unlock the M580 Ethernet port and the BMECXM010 Ethernet port security, set the CANopen baud rate, project browser – double-click CANopen slave to configure and add CANopen slave device nodes. See the following Figures 3.1-3.5:
Figure 3.1
Figure 3.2
Figure 3.3
Figure 3.4
Figure 3.5
3.2 Adding Third-party CANopen EDS Files
If the CANopen device to be communicated is already in the Control Expert software “New Device” list, then you can directly configure and add this device node in the project browser-CANopen slave; if the device to be communicated is not in the “New Device” list, you need to first close the Control Expert software, search for “Hardware Directory Editor” in the Windows operating system “Start” menu to add it, and then you can directly configure and add this device node in the project browser-CANopen slave. Set the path as follows: Hardware Directory Editor – click on CANopen slave – Edit – Add Device – select the EDS file to be added – Open – Add. Detailed steps are shown in Figures 3.6-3.11:
Figure 3.6
Figure 3.7
Figure 3.8
Figure 3.9
Figure 3.10
Figure 3.11
3.3 CANopen Communication Program Writing
3.3.1 PDO Communication
CANopen communication is divided into PDO and SDO parts. PDO communication is directly mapped to the Device DDT variables in the Control Expert software when adding devices, and no programming is required, as shown in Figure 3.12:
Figure 3.12
3.3.2 SDO Communication
SDO communication requires using READ_SDO and WRITE_SDO in the Control Expert software to write the program, linking the CANopen device ID and the parameter index and sub-index address. Create a new FBD program segment A to read SDO, reading the position value of the encoder with node number 1, SDO object index 6004h (24580), sub-index 00h. The ENABLE enable terminal needs to be set to 1 to start reading. 0.0.3 is the third slot, and 192.168.10.2 is the address of the CANopen module. See Figure 3.13:
Figure 3.13
Create a new FBD program segment B to write SDO, writing the zero value 00h to the encoder with node number 1, SDO object index 6003h (24579), sub-index 00h, to perform the zeroing operation on the encoder. The ENABLE enable terminal needs to be set to 1 to execute the zeroing function. 0.0.3 is the third slot, and 192.168.10.2 is the address of the CANopen module, see Figure 3.14.
Figure 3.14
After writing the program, click “Generate” in the menu and select “Build All”. After no errors, click “PLC” in the menu and select “Standard Mode”, then click “Connect” and execute “Transfer Project to PLC”, and then click “Run” in the PLC menu to execute the program, see Figures 3.15-3.18.
Figure 3.15
Figure 3.16
Figure 3.17
Figure 3.18
After the program runs normally, double-click on BMECXM0100 to directly monitor the operating status of this module, as shown in Figure 3.19:
Figure 3.19
Create a new dynamic data table, add the automatically generated encoder Device DDT variable, rotate the encoder shaft, and the current value of the encoder can be read, as shown in Figure 3.20:
Figure 3.20
In the above figure, the parameters read by SDO and the parameters mapped by PDO configuration are both Position Value. The value 1048572 converted to hexadecimal is 00 0F FF FC, corresponding to the output pin DATA_OUT array DATA_RSDO of READ_SDO (DATA_RSDO[4]=0, DATA_RSDO[3]=15, DATA_RSDO[2]=255, DATA_RSDO[1]=252). This encoder has a single turn of 12 bits 1024 (high 12 bits), and 12 bits for the number of turns totaling 1024 turns (low 12 bits). The Position Value of 1048572 represents 1023 turns and 1020. 1048576 is the critical value, and going beyond 1048575 is 0.
4. Module Status Diagnosis
After normally downloading the program and waiting for about 30 seconds, the BMECXM0100 module starts normally with RUN, BS, and CAN RUN three green lights on. The module’s operating status can be judged through the panel indicator lights:
The module is in RUN status, which is a prerequisite for diagnosing I/O exchanges with CANopen devices through LED. The following table shows the diagnostic results reflected by the I/O and CAN ERR LED combinations:
5. Experiment Summary
The encoder WDGA 58B-10-1212-COA-B00-CB5-AAS has a default node of 127 from the factory, and the maximum CANopen slave node address supported by the CANopen X80 master station module BMECXM0100 is 63. It is necessary to set the CANopen slave node address of this encoder to within the valid range (0-63) before connecting this encoder to the CANopen protocol using the BMECXM0100 module.