当前位置:网站首页>干货!教您使用工业树莓派结合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主站/从站,之后也会逐渐分享给大家相应的配置文档。
更多资讯: 虹科工业物联网--您的工业物联网专家
边栏推荐
- lvm logical volume and disk quota
- 单臂路由实验和三层交换机实验
- [Day8] (Super detailed steps) Use LVM to expand capacity
- Growth: IT Operations Trends Report
- NIO工作方式浅析
- Why can't I add a new hard disk to scan?How to solve?
- [Paper Intensive Reading] The relationship between Precision-Recall and ROC curves
- Regular expression small example - get number character and repeated the most
- 从“双卡双待“到”双通“,vivo率先推动DSDA架构落地
- ACL 和NAT
猜你喜欢

ALC实验

The problem of redirecting to the home page when visiting a new page in dsf5.0

Getting Started Doc 08 Conditional Plugins

What?CDN cache acceleration only works for accelerating static content?

Introductory document 05-2 use return instructions the current task has been completed
![[Day6] File system permission management, file special permissions, hidden attributes](/img/ec/7fb3fa671fac8abf389844c0f4fbe7.png)
[Day6] File system permission management, file special permissions, hidden attributes

network issue?Service packet loss?This is enough

OpenCV3.0 is compatible with VS2010 and VS2013

入门文档06 向流(stream)中添加文件

LinkSLA坚持用户第一,打造可持续的运维服务方案
随机推荐
智能运维会取代人工运维吗?
运维的高光时刻,从智能化开始
spark operator-parallelize operator
VLAN介绍与实验
spark operator-wholeTextFiles operator
Getting Started Documentation 10 Resource Mapping
Dsf5.0 bounced points determine not return a value
User and user group management, file permission management
Getting Started Document 07 Staged Output
Insight into the general trend of the Internet, after reading this article, you will have a thorough understanding of Chinese domain names
Servlet跳转到JSP页面,转发和重定向
实力卷王LinkSLA,实现运维工程师快乐摸鱼
传输层协议(TCP3次握手)
入门文档08 条件插件
入职前,没想到他们玩的这么花
【Day8】RAID Disk Array
[Day6] File system permission management, file special permissions, hidden attributes
IP packet format (ICMP protocol and ARP protocol)
ROS video tutorial
入门文档04 一个任务依赖另外一个任务时,需要按顺序执行