当前位置:网站首页>干货!教您使用工业树莓派结合CODESYS配置EtherCAT主站
干货!教您使用工业树莓派结合CODESYS配置EtherCAT主站
2022-08-05 05:22:00 【hongke_iiot】
前言
工业树莓派可以结合CODESYS作为小型工控机,支持多种现场总线协议应用,例如EtherNET/IP、Profinet、EtherCAT等。其中,通过与CODESYS结合的方式实现EtherCAT,支持工业树莓派作为EtherCAT主站,控制EtherCAT IO模块或者EtherCAT伺服电机。本文将分享如何将工业树莓派配置为EtherCAT主站,并与伺服驱动器通讯。
一、 所需工具
1. 一个工业树莓派核心模块/控制器模块,本次测试使用 Connect+feat. CODESYS 模块
2. 一个伺服电机
3. CODESYS 多核授权(树莓派版本)
二、 操作步骤
1. 添加伺服电机描述文件
点击“工具”->“设备存储库”,点击“安装”,选择伺服电机的设备描述文件


2. 新建工程

3. 工程类型
测试使用的codesys授权是多核版本,所以选择CODESYS Control for Raspberry Pi MC SL;如果是单核版本请选择CODESYS Control for Raspberry Pi SL。

4. 添加设备-控制器
右击“Device”,选择添加设备,找到“其他项”,选择添加使用的控制器模块,点击“添加设备”。(本次测试使用的是Connect模块)

5. 添加EtherCAT主站
a. 右击“Device”,选择添加设备,找到“现场总线”,选择添加“EtherCAT”->“EtherCAT Master”。

b. 右击“EtherCAT_Master”,添加伺服电机,即添加描述文件后出现的设备。

c. 右击“EP3E_EC”,添加“SoftMotion CiA402轴”。

d. 双击“EtherCAT_Master”,选择“通用”,选择“按MAC地址选择网络”,点击源地址的“浏览”,选择伺服电机与工业树莓派连接的以太网口的IP地址。(本次测试使用的是B口,即eth1)

e. 双击“EP3E-EC”,点击“通用”,勾选“专家设置“,设置分布式时钟。

f. 点击“启动参数”,点击“添加”,分别添加“Max torque”和“Max motor speed”。

g. 分别设置“Max torque”和“Max motor speed”的值为1000和4000.

h. 打开“SM_Drive_GenericDSP402 ”设置页。
i. 打开SoftMotion驱动:缩放/映射。
j. 把电机旋转一圈,编码器增量设置为1000。

6. 程序编写
a. 打开PLC_PRG,鼠标点击变量声明区空白处。

b. 按F2键调出输入助手,点击文本搜索,输入使能功能块关键字:power,选择功能块SMC_Basic.MC_Power,点击确定。

c. 实例化MC_Power功能块。

d. 同样的方式添加MC_Jog功能块,并实例化MC_Jog功能块。

e. 点击程序编辑区,按F2 键,调出输入助手,点击实例调用选择实例fbMC_Power,点击确定。

f. 填写相关变量。

g. 同样的方式配置MC_Jog功能块。

h. 将PLC_PRG从MainTask任务中,拖放到EtherCAT_Task任务中,如图所示。

7. 程序下载和设备登录
8. 调试
a. 尝试修改lVel的值,双击“lVel”,修改为100,点击确认,快捷键Ctrl+F7,确认写入。查看是否有变化。


b. 双击“bPower”,查看是否有变化。

9. 测试完毕。
三、 总结
工业树莓派结合CODESYS不仅仅支持EtherCAT主站,还可以支持Modbus TCP/RTU 主站/从站、CANopen主站/从站,之后也会逐渐分享给大家相应的配置文档。
更多资讯: 虹科工业物联网--您的工业物联网专家
边栏推荐
- Logical volume creation
- [Paper Intensive Reading] The relationship between Precision-Recall and ROC curves
- Call the TensorFlow Objection Detection API for object detection and save the detection results locally
- What?CDN cache acceleration only works for accelerating static content?
- Getting Started Doc 06 Adding files to a stream
- 【Day8】Knowledge about disk and disk partition
- vim教程:vimtutor
- VRRP原理及命令
- Hard Disk Partitioning and Permanent Mounting
- Three modes of vim
猜你喜欢

Getting Started Documentation 12 webserve + Hot Updates

Getting Started Doc 06 Adding files to a stream

入门文档07 分阶段输出

单臂路由实验和三层交换机实验

In-depth Zabbix user guide - from the green boy

技术分享杂七杂八技术

RAID磁盘阵列

LinkSLA insists that users come first and creates a sustainable operation and maintenance service plan

入门文档09 独立的watch
![[Pytorch study notes] 8. How to use WeightedRandomSampler (weight sampler) when the training category is unbalanced data](/img/29/5b44c016bd11f0c0a9110cf513f4e1.png)
[Pytorch study notes] 8. How to use WeightedRandomSampler (weight sampler) when the training category is unbalanced data
随机推荐
Spark source code-task submission process-6.1-sparkContext initialization-create spark driver side execution environment SparkEnv
入门文档05 使用cb()指示当前任务已完成
IP address and subnet division
传输层协议
Getting Started Doc 08 Conditional Plugins
Disk management and file systems
vim教程:vimtutor
入门文档05-2 使用return指示当前任务已完成
VLAN details and experiments
Getting Started 03 Distinguish between development and production environments ("hot update" is performed only in the production environment)
Logical volume creation
入门文档06 向流(stream)中添加文件
js dynamically get screen width and height
By solving these three problems, the operation and maintenance efficiency will exceed 90% of the hospital
Small example of regular expression--validate email address
spark operator-parallelize operator
[Day6] File system permission management, file special permissions, hidden attributes
[Day8] Commands involved in using LVM to expand
VRRP原理及命令
The problem come from line screening process