当前位置:网站首页>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},
边栏推荐
- POSIX共享内存
- Jetpack compose management status (I)
- aws elastic beanstalk入门之简介
- PTA l3-032 questions about depth first search and reverse order pair should not be difficult (30 points)
- EtherCAT igh函数尝试
- Vit is crazy, 10+ visual transformer model details
- Simulation of vector
- Analysis of 43 cases of MATLAB neural network: Chapter 27 prediction of LVQ Neural Network - face orientation recognition
- Bm95 points candy problem
- 潤邁德醫療通過上市聆訊:預計虧損將增加,霍雲飛兄弟持股約33%
猜你喜欢

3DE 网格坐标点与物体的附加

MySQL 1055 error -this is incompatible with SQL_ mode=only_ full_ group_ By solution

大型网站技术架构 | 应用服务器安全防御

EtherCAT对象字典分析

RT thread persimmon pie M7 Quanzhi f133 DDR running xboot

堆栈认知——栈溢出实例(ret2libc)

加速雲原生應用落地,焱融 YRCloudFile 與天翼雲完成兼容性認證

润迈德医疗通过上市聆讯:预计亏损将增加,霍云飞兄弟持股约33%

一招教你通过焱融 SaaS 数据服务平台+ELK 让日志帮你做决策

3DE motion contour data modification
随机推荐
EtherCAT igh 'Fatal Sync Error'——0x002C,0x001A
National administrative division
Xlrd finds the row of the specified content and its content
Reids面试题集合 数据结构+穿透雪崩+持久化+内存淘汰策略+数据库双写+哨兵
Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which
3DE 运动轮廓数据修改
Google play application signature key certificate, upload signature certificate difference
AttributeError: ‘Book‘ object has no attribute ‘sheet‘
Stack awareness - stack overflow instance (ret2libc)
加速雲原生應用落地,焱融 YRCloudFile 與天翼雲完成兼容性認證
Go corn timing task simple application
潤邁德醫療通過上市聆訊:預計虧損將增加,霍雲飛兄弟持股約33%
Redis6.0 new features (Part 1)
Development of digital collection system and construction of NFT artwork trading platform
Simulation Implementation of list
3DE 三維模型視圖看不到怎麼調整
Volcano engine + Yanrong yrcloudfile, driving new growth of data storage
Analysis of 43 cases of MATLAB neural network: Chapter 26 classification of LVQ Neural Network - breast tumor diagnosis
基于AM4377的EtherCAT主站控制stm32从站
Stm32f1 and stm32subeide programming example - linear Hall effect sensor driver