当前位置:网站首页>EtherCAT object dictionary analysis
EtherCAT object dictionary analysis
2022-06-21 17:57:00 【Marathon】
EtherCAT In development , It is mainly checked through two software XML file , Namely "XML Notepad" and "Altova XMLSpy", The two interfaces are as follows :

By contrast, we can see Altova XMLSpy The software display is more intuitive , Therefore, I mainly use this software during development .
Let's get to the point . adopt igh Development EtherCAT The application must first know the object dictionary of the slave station , We can go through igh Self contained ethercat The software views the object dictionary of the slave station . The experimental equipment is equipped with xenomai and igh Of am4377 Development board 、 Biff EL2008 From the station and Taobao store “ Easy element electron ” Of stm32 From station .
Enter at the command line ethercat cstruct You can view the object dictionary of all slave devices connected to the master . This paper mainly discusses the slave station 4, That's what this is stm32 Analyze from the object dictionary of the station , adopt ethercat The information found by the tool is as follows :
/* Master 0, Slave 4, "LAN9252-EVB-HBI"
* Vendor ID: 0x00000009
* Product code: 0x00009252
* Revision number: 0x00000001
*/
ec_pdo_entry_info_t slave_4_pdo_entries[] = {
{0x7010, 0x01, 1}, /* LED 1 */
{0x7010, 0x02, 1}, /* LED 2 */
{0x7010, 0x03, 1}, /* LED 3 */
{0x7010, 0x04, 1}, /* LED 4 */
{0x7010, 0x05, 1}, /* LED 5 */
{0x7010, 0x06, 1}, /* LED 6 */
{0x7010, 0x07, 1}, /* LED 7 */
{0x7010, 0x08, 1}, /* LED 8 */
{0x0000, 0x00, 8}, /* Gap */
{0x6000, 0x01, 1}, /* Switch 1 */
{0x6000, 0x02, 1}, /* Switch 2 */
{0x6000, 0x03, 1}, /* Switch 3 */
{0x6000, 0x04, 1}, /* Switch 4 */
{0x6000, 0x05, 1}, /* Switch 5 */
{0x6000, 0x06, 1}, /* Switch 6 */
{0x6000, 0x07, 1}, /* Switch 7 */
{0x6000, 0x08, 1}, /* Switch 8 */
{0x0000, 0x00, 8}, /* Gap */
{0x6020, 0x01, 1}, /* Underrange */
{0x6020, 0x02, 1}, /* Overrange */
{0x6020, 0x03, 2}, /* Limit 1 */
{0x6020, 0x05, 2}, /* Limit 2 */
{0x0000, 0x00, 8}, /* Gap */
{0x1802, 0x07, 1}, /* TxPDOState */
{0x1802, 0x09, 1}, /* TxPDO Toggle */
{0x6020, 0x11, 16}, /* Analog input */
};
ec_pdo_info_t slave_4_pdos[] = {
{0x1601, 9, slave_4_pdo_entries + 0}, /* DO RxPDO-Map */
{0x1a00, 9, slave_4_pdo_entries + 9}, /* DI TxPDO-Map */
{0x1a02, 8, slave_4_pdo_entries + 18}, /* AI TxPDO-Map */
};
ec_sync_info_t slave_4_syncs[] = {
{0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
{1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
{2, EC_DIR_OUTPUT, 1, slave_4_pdos + 0, EC_WD_ENABLE},
{3, EC_DIR_INPUT, 2, slave_4_pdos + 1, EC_WD_DISABLE},
{0xff}
};
stm32 The slave station mainly realizes 8 Channel input 、8 Channel output and 1 road ad Conversion function .
ec_pdo_entry_info_t Structure
The first part of the slave station information is a relatively simple object dictionary corresponding to each variable , such as LED 1 The main index number of the corresponding object dictionary is 0x7010、 The subindex number is 0x01、 The size is 1bit. We can check ec_pdo_entry_info_t Structure for more details .
/** PDO entry configuration information.
* This is the data type of the \a entries field in ec_pdo_info_t.
* \see ecrt_slave_config_pdos().
*/
typedef struct {
uint16_t index; /**< PDO entry index. */
uint8_t subindex; /**< PDO entry subindex. */
uint8_t bit_length; /**< Size of the PDO entry in bit. */
} ec_pdo_entry_info_t;
see XML The corresponding part in the document .
ec_pdo_info_t Structure
This part mainly describes PDO The mapping of data .TxPDO Sending data from the slave station to the master station ,RxPDO Receiving data from the slave station to the master station .
Here's the picture ,TxPDO Is composed of mapping relationships 16XX To determine the sort and length , Mapping management 0x1C12 The value of determines which mapping relationships to use ( One or more ). Empathy RxPDO So it is with .
ec_pdo_info_t The structure information is as follows :
/** PDO configuration information.
* This is the data type of the \a pdos field in ec_sync_info_t.
* \see ecrt_slave_config_pdos().
*/
typedef struct {
uint16_t index; /**< PDO index. */
unsigned int n_entries; /**< Number of PDO entries in \a entries to map.
Zero means, that the default mapping shall be
used (this can only be done if the slave is
present at bus configuration time). */
ec_pdo_entry_info_t *entries; /**< Array of PDO entries to map. Can either
be \a NULL, or must contain at
least \a n_entries values. */
} ec_pdo_info_t;
With {0x1601, 9, slave_4_pdo_entries + 0}, /* DO RxPDO-Map */ For example . The slave station uses 0x1601 To manage slave_4_pdo_entries [0] At the beginning 9 A variable :
{0x7010, 0x01, 1}, /* LED 1 */
{0x7010, 0x02, 1}, /* LED 2 */
{0x7010, 0x03, 1}, /* LED 3 */
{0x7010, 0x04, 1}, /* LED 4 */
{0x7010, 0x05, 1}, /* LED 5 */
{0x7010, 0x06, 1}, /* LED 6 */
{0x7010, 0x07, 1}, /* LED 7 */
{0x7010, 0x08, 1}, /* LED 8 */
{0x0000, 0x00, 8}, /* Gap */
XML The corresponding parts in are as follows 
ec_sync_info_t Structure
This part mainly describes sm Configuration information .
/** Sync manager configuration information.
* This can be use to configure multiple sync managers including the PDO
* assignment and PDO mapping. It is used as an input parameter type in
* ecrt_slave_config_pdos().
*/
typedef struct {
uint8_t index; /**< Sync manager index. Must be less
than #EC_MAX_SYNC_MANAGERS for a valid sync manager,
but can also be \a 0xff to mark the end of the list. */
ec_direction_t dir; /**< Sync manager direction. */
unsigned int n_pdos; /**< Number of PDOs in \a pdos. */
ec_pdo_info_t *pdos; /**< Array with PDOs to assign. This must contain
at least \a n_pdos PDOs. */
ec_watchdog_mode_t watchdog_mode; /**< Watchdog mode. */
} ec_sync_info_t;
First, check out the XML file .
In this case ,sm0 management MBoxOut,sm1 management MBoxIn, because stm32 The slave program does not use email communication , Therefore, there is no data transmission in this part , So the structure is set as follows :
{0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
{1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
From the previous part slave_4_pdos You know , This article uses 1 individual RxPDO and 2 individual TxPDO.sm2 management RxPDO Therefore, the direction in the structure is set to EC_DIR_OUTPUT, The number is set to 1, The starting position is slave_4_pdos[0].sm3 management TxPDO Therefore, the direction in the structure is set to EC_DIR_INPUT, The number is set to 2, The starting position is slave_4_pdos[1].
{2, EC_DIR_OUTPUT, 1, slave_4_pdos + 0, EC_WD_ENABLE},
{3, EC_DIR_INPUT, 2, slave_4_pdos + 1, EC_WD_DISABLE},
边栏推荐
- 天天在都在谈的S3协议到底是什么?一文带你了解S3背后的故事
- 3DE 网格坐标点与物体的附加
- BFS and DFS
- Lagrange interpolation
- EtherCAT igh 'Fatal Sync Error'——0x002C,0x001A
- Accelerate the implementation of cloud native applications, and Yanrong yrcloudfile and Tianyi cloud have completed the Compatibility Certification
- Let, with, apply, also, run
- Side effects in compose
- RT-Thread 柿饼派M7 全志F133 ddr 运行xboot
- 不是一流大学毕业,却通过自学软件测试,进了阿里年薪初始22K
猜你喜欢

数字经济王宁教你如何正确地选择短期投资

EtherCAT对象字典分析

POSIX信号量

Zhong'an insurance, together with Alibaba health and huiyitianxia, explores a new model of Internet chronic disease management

从需求到开源,如何做到刮目相看?

【ORACLE】Oracle里有“time”数据类型吗?--关于对Oracle数据类型的一点研究

Software test architecture learning and construction (14) - overview of software test and development model of test foundation

3DE motion contour data modification
![[real topic of the Blue Bridge Cup provincial tournament 35] scratch water reflection children's programming scratch programming explanation of the real topic of the Blue Bridge Cup provincial tournam](/img/02/3a05b21a49036e3fba95fd41c4a048.png)
[real topic of the Blue Bridge Cup provincial tournament 35] scratch water reflection children's programming scratch programming explanation of the real topic of the Blue Bridge Cup provincial tournam

Nacos注册中心-----从0开始搭建和使用
随机推荐
堆栈认知——逆向IDA工具的基本使用
PingCAP 入选 2022 Gartner 云数据库“客户之声”,获评“卓越表现者”最高分
我被变相降薪了
Convert longitude and latitude to distance
What is the S3 protocol that we are talking about every day? This article takes you to understand the story behind S3
Analysis of 43 cases of MATLAB neural network: Chapter 26 classification of LVQ Neural Network - breast tumor diagnosis
Jetpack compose phase
Xticks function in MATLAB
[real topic of the Blue Bridge Cup provincial tournament 35] scratch water reflection children's programming scratch programming explanation of the real topic of the Blue Bridge Cup provincial tournam
regular expression
【蓝桥杯省赛真题35】Scratch水面倒影 少儿编程scratch编程蓝桥杯省赛真题讲解
Pingcap was selected as the "voice of customers" of Gartner cloud database in 2022, and won the highest score of "outstanding performer"
Technical architecture of large websites | information encryption technology and key security management
Stack awareness - stack overflow instance (ret2libc)
PTA l3-032 questions about depth first search and reverse order pair should not be difficult (30 points)
鱼佬:电信客户流失预测赛方案!
aws elastic beanstalk入门之简介
Accelerate the implementation of cloud native applications, and Yanrong yrcloudfile and Tianyi cloud have completed the Compatibility Certification
Deeply understand the attention mechanism of map
wcdma与LTE的区别