EtherCAT xml配置文件编写和DSP程序适配,以 ET1100与DSP28335为例(2)

目的:
TwinCAT3 主站发送(28335接收 ) speed torque 2个 模拟量 (xml文件中:RxPdo )
此部分仍然是 xml文件中 RxPdo 的编写。
RxPdo 中增加 2个 模拟量(未做说明,均为 左图,上图 为 修改前;右图下图为修改后)
位置1
ethercatinfo --> descriptions --> devices --> device --> RxPdo
在这里插入图片描述大红圈= 绿色箭头所指
左棕圈 text 内容可以删除,右棕圈 为 模拟量 name
左 蓝色箭头 所指 即为要增加的 输出模拟量
棕色箭头 为#x1602 蓝色箭头为#x6411 均为 RxPdo的索引范围为,这两个索引 为新增加

位置2
增加 datatype DT1602
ethercatinfo --> descriptions --> devices --> device --> profile --> dictionary --> datatypes --> datatype --> DT1602
在这里插入图片描述
参考DT1A02,在DT1601下面添加DT1602
绿圈 272=240+32. 这里1602 包含8个 16为变量,我们只是用了 其中的2个。
el9800appl.h
程序位置 1
在这里插入图片描述增加 TOBJ1602 结构体
程序2
增加
在这里插入图片描述
1C12 包含 1601 和1602 ,增加了1602,所以 红箭头指处 为 2
程序3
增加
在这里插入图片描述注意红箭头处更改

位置3
增加object #x1602
ethercatinfo --> descriptions --> devices --> device --> profile --> dictionary --> objectss --> object --> #x1602
在这里插入图片描述参考#x1a02,在#x1601下面 增加#x1602
红圈 10011146 含义:
10 : 16bit
01: 第一个
1146: 6411 倒写 6411为下一个增加的索引。这里无需部位。

程序4
增加
在这里插入图片描述
1c12 datatype
在这里插入图片描述
1c12 object
在这里插入图片描述
更改:
在这里插入图片描述
程序6:
增加
在这里插入图片描述

在这里插入图片描述
至此增加 #x1602 的xml文件和dsp28335 程序 完毕。

位置4
增加datatype DT6411
ethercatinfo --> descriptions --> devices --> device --> profile --> dictionary --> datatypes --> datatype --> DT6411
在这里插入图片描述参考DT6020,增加DT6411
注意红圈间的关系,绿圈不用动。
程序1
增加
在这里插入图片描述
参考6020,增加 6411,注意变量名称
程序2
在这里插入图片描述标记处做好相应更改
程序3
增加
在这里插入图片描述

位置5
增加object #x6411
ethercatinfo --> descriptions --> devices --> device --> profile --> dictionary --> objectss --> object --> #x6411
在这里插入图片描述参考#x6020,增加#x6411,
注意绿圈中的name 和数值 与 dstatype中 6411 相等即可。
程序4
参考 6020 增加 6411
在这里插入图片描述

至此,6411相关xml 及.h文件中,更改完毕。
最后,更改 main.c中的程序:
程序1:
在这里插入图片描述ecatappl.h 中增加两个全局变量
PROTO UINT16 Torque;
PROTO UINT16 Speed;
程序2:
main.c中,增加
在这里插入图片描述
程序3:
增加红框内容
在这里插入图片描述

至此,完成 Torque,Speed 两个模拟量的添加。即可通过TwinCAT3 发送指令到28335中,效果如图:
在twincat3中 编辑torque speed 的值,dsp中即可实时显示。
在这里插入图片描述

RxPdo,相关更改,全部结束。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值