EtherCAT主站SOEM函数详解----SDO读写函数

EtherCAT主站SOEM函数详解----SDO读写函数

  • ethercatcoe.h头文件
  • SDO读写函数
    • SDO读取函数
    • SDO写函数

获取SOEM主站或了解文件分布,可以读取我以前写的博客SOEM主站软件包及函数头文件介绍,本篇ethercatcoe文件相关的函数,COE的全称是CanOpen over EtherCAT, 采用CanOpen的相关协议开发了EtherCAT的运用层,核心是对象字典,想了解PDO相关知识,可以读CanOpen通信----PDO与SDO。对于报文结构体相关知识,可以参照EtherCAT数据帧及SOEM报文数据结构介绍,对下文的理解有一定帮组。

ethercatcoe.h头文件

为了比较全面的了解COE, 本文将先给出ethercatcoe.h的头文件,如下所示,其中核心的是读写函数。

/*
 * Licensed under the GNU General Public License version 2 with exceptions. See
 * LICENSE file in the project root for full license information
 */

/** \file
 * \brief
 * Headerfile for ethercatcoe.c
 */

#ifndef _ethercatcoe_
#define _ethercatcoe_

#ifdef __cplusplus
extern "C"
{
   
#endif

/** max entries in Object Description list */
#define EC_MAXODLIST   1024

/** max entries in Object Entry list */
#define EC_MAXOELIST   256

/* Storage for object description list */
typedef struct
{
   
   /** slave number */
   uint16  Slave;
   /** number of entries in list */
   uint16  Entries;
   /** array of indexes */
   uint16  Index[EC_MAXODLIST];
   /** array of datatypes, see EtherCAT specification */
   uint16  DataType[EC_MAXODLIST];
   /** array of object codes, see EtherCAT specification */
   uint8   ObjectCode[EC_MAXODLIST];
   /** number of subindexes for each index */
   uint8   MaxSub[EC_MAXODLIST];
   /** textual description of each index */
   char    Name[EC_MAXODLIST][EC_MAXNAME+1];
} ec_ODlistt;

/* storage for object list entry information */
typedef struct
{
   
   /** number of entries in list */
   uint16 Entries;
   /** array of value infos, see EtherCAT specification */
   uint8  ValueInfo[EC_MAXOELIST];
   /** array of value infos, see EtherCAT sp

你可能感兴趣的:(SDO读写函数,SOEM)