目的:
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,相关更改,全部结束。