⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ci.h

📁 基于EthernetIP协议的应用程序,可以读取AB公司Controllogix系列Ethernetip协议PLC数据. 此软件代码可用于工业控制.
💻 H
📖 第 1 页 / 共 3 页
字号:
#define CI_DATA_SEG_SYMBOL          0x91   /* ANSI Extended Symbol segment.*/


/*---------------------------------------------------------------------------
**
** Common Service Codes
**
**---------------------------------------------------------------------------
*/

#define CI_SC_REPLY_MASK            0x80

#define CI_SC_GET_ATTR_ALL          0x01
#define CI_SC_SET_ATTR_ALL          0x02
#define CI_SC_GET_ATTR_LIST         0x03
#define CI_SC_SET_ATTR_LIST         0x04
#define CI_SC_RESET                 0x05
#define CI_SC_START                 0x06
#define CI_SC_STOP                  0x07
#define CI_SC_CREATE                0x08
#define CI_SC_DELETE                0x09
#define CI_SC_APPLY_ATTRIBUTES      0x0D
#define CI_SC_GET_ATTR_SINGLE       0x0E
#define CI_SC_SET_ATTR_SINGLE       0x10
#define CI_SC_FIND_NEXT_OBJ_INST    0x11
#define CI_SC_RESTORE               0x15
#define CI_SC_SAVE                  0x16
#define CI_SC_NO_OP                 0x17
#define CI_SC_GET_MEMBER            0x18
#define CI_SC_SET_MEMBER            0x19



/*---------------------------------------------------------------------------
**
** Common General Response Codes
**
**---------------------------------------------------------------------------
*/

#define CI_GRC_SUCCESS              0x00  /* We done good...               */
#define CI_GRC_FAILURE              0x01  /* Connection failure            */
#define CI_GRC_NO_RESOURCE          0x02  /* Resource(s) unavailable       */
#define CI_GRC_BAD_DATA             0x03  /* Obj specific data bad         */
#define CI_GRC_BAD_PATH             0x04  /* Path segment hosed            */
#define CI_GRC_BAD_CLASS_INSTANCE   0x05  /* Class/instance unknown        */
#define CI_GRC_PARTIAL_DATA         0x06  /* Not all expected data sent    */
#define CI_GRC_CONN_LOST            0x07  /* Messaging connection lost     */
#define CI_GRC_BAD_SERVICE          0x08  /* Unimplemented service code    */
#define CI_GRC_BAD_ATTR_DATA        0x09  /* Bad attribute data value      */
#define CI_GRC_ATTR_LIST_ERROR      0x0A  /* Get/set attr list failed      */
#define CI_GRC_ALREADY_IN_MODE      0x0B  /* Obj already in requested mode */
#define CI_GRC_BAD_OBJ_MODE         0x0C  /* Obj not in proper mode        */
#define CI_GRC_OBJ_ALREADY_EXISTS   0x0D  /* Object already created        */
#define CI_GRC_ATTR_NOT_SETTABLE    0x0E  /* Set of get only attr tried    */
#define CI_GRC_PERMISSION_DENIED    0x0F  /* Insufficient access permission*/
#define CI_GRC_DEV_IN_WRONG_STATE   0x10  /* Device not in proper mode     */
#define CI_GRC_REPLY_DATA_TOO_LARGE 0x11  /* Response packet too large     */
#define CI_GRC_FRAGMENT_PRIMITIVE   0x12  /* Primitive value will fragment */
#define CI_GRC_CONFIG_TOO_SMALL     0x13  /* Goldilocks complaint #1       */
#define CI_GRC_UNDEFINED_ATTR       0x14  /* Attribute is undefined        */
#define CI_GRC_CONFIG_TOO_BIG       0x15  /* Goldilocks complaint #2       */
#define CI_GRC_OBJ_DOES_NOT_EXIST   0x16  /* Non-existant object specified */
#define CI_GRC_NO_FRAGMENTATION     0x17  /* Fragmentation not active      */
#define CI_GRC_DATA_NOT_SAVED       0x18  /* Attr data not previously saved*/
#define CI_GRC_DATA_WRITE_FAILURE   0x19  /* Attr data not saved this time */
#define CI_GRC_REQUEST_TOO_LARGE    0x1A  /* Routing failure on request    */
#define CI_GRC_RESPONSE_TOO_LARGE   0x1B  /* Routing failure on response   */
#define CI_GRC_MISSING_LIST_DATA    0x1C  /* Attr data not found in list   */
#define CI_GRC_INVALID_LIST_STATUS  0x1D  /* Returned list of attr w/status*/
#define CI_GRC_SERVICE_ERROR        0x1E  /* Embedded service failed       */
#define CI_GRC_CONN_RELATED_FAILURE 0x1F  /* Error in conn processing      */
#define CI_GRC_INVALID_PARAMETER    0x20  /* Invalid Parameter             */
#define CI_GRC_WRITE_ONCE_FAILURE   0x21  /* Write once previously done    */
#define CI_GRC_INVALID_REPLY        0x22  /* Invalid reply received        */
#define CI_GRC_BAD_KEY_IN_PATH      0x25  /* Electronic key in path failed */
#define CI_GRC_BAD_PATH_SIZE        0x26  /* Invalid path size             */
#define CI_GRC_UNEXPECTED_ATTR      0x27  /* Cannot set attr at this time  */
#define CI_GRC_INVALID_MEMBER       0x28  /* Member ID in list nonexistant */
#define CI_GRC_MEMBER_NOT_SETTABLE  0x29  /* Cannot set value of member    */

#define CI_GRC_STILL_PROCESSING     0xFF  /* Special marker to indicate    */
                                          /* we haven't finished processing */
                                          /* the request yet               */





/****************************************************************************
**
** Typedefs
**
*****************************************************************************
*/


/*---------------------------------------------------------------------------
**
** CI_DiagnosticFixedTagType
**
** Format of contents of a ControlNet diagnostic fixed tag.
**
**---------------------------------------------------------------------------
*/

typedef packet_struct CI_LeDiagnosticFixedTagType
{
   LeUINT16   iLeObjid;
   LeUINT16   iLeWord1;
   LeUINT16   iLeWord2;
}
GNU_PACKED CI_LeDiagnosticFixedTagType;



/*---------------------------------------------------------------------------
**
** CI_FixedTagHeaderType
**
** Format of header for ControlNet fixed tag LPackets.
**
**---------------------------------------------------------------------------
*/

typedef packet_struct CI_FixedTagHeaderType
{
   UINT8 bSize;
   UINT8 bControl;
   UINT8 bFixedTag;
   UINT8 bDestMAC;
}
GNU_PACKED CI_FixedTagHeaderType;



/*---------------------------------------------------------------------------
**
** CI_GenTagHeaderType
** CI_LeGenTagTranHeaderType
**
** Format of header for ControlNet generic (& hybrid) tag LPackets,
** with and without the transport header (sequence number).
**
**---------------------------------------------------------------------------
*/

typedef packet_struct CI_GenTagHeaderType
{
   UINT8 bSize;
   UINT8 bControl;
   UINT8 bTagPad;
   UINT8 bTag0;
   UINT8 bTag1;
   UINT8 bTag2;
}
GNU_PACKED CI_GenTagHeaderType;

typedef packet_struct CI_LeGenTagTranHeaderType
{
   UINT8    bSize;
   UINT8    bControl;
   UINT8    bTagPad;
   UINT8    bTag0;
   UINT8    bTag1;
   UINT8    bTag2;
   LeUINT16 iLeSeqCount;
}
GNU_PACKED CI_LeGenTagTranHeaderType;



/*---------------------------------------------------------------------------
**
** CI_GoodReplyHeaderType
**
** Good reply header.
**
**---------------------------------------------------------------------------
*/

typedef packet_struct CI_GoodReplyHeaderType
{
   UINT8 bService;
   UINT8 bIoiSize;         /* Always 0 */

   UINT8 bGenStatus;       /* Always 0 */
   UINT8 bObjStatusSize;   /* Always 0 */
}
GNU_PACKED CI_GoodReplyHeaderType;



/*---------------------------------------------------------------------------
**
** CI_IoiType
**
** IOI structure.
**
**---------------------------------------------------------------------------
*/

typedef packet_struct CI_IoiType
{
   UINT8 bService;
   UINT8 bIoiSize;
   /* LeUINT16 aiIoi[];  Implied field of variable length (zero or more)   */
}
GNU_PACKED CI_IoiType;



/*---------------------------------------------------------------------------
**
** CI_IoiCIType
**
** IOI with class/instance structure.
**
**---------------------------------------------------------------------------
*/

typedef packet_struct CI_IoiCIType
{
   UINT8 bService;
   UINT8 bIoiSize;

   UINT8 bClassSeg;
   UINT8 bClass;

   UINT8 bInstanceSeg;
   UINT8 bInstance;
}
GNU_PACKED CI_IoiCIType;



/*---------------------------------------------------------------------------
**
** CI_LeBadReplyHeaderType
**
** Error reply header (sort of IOI-ish).
**
**---------------------------------------------------------------------------
*/

typedef packet_struct CI_LeBadReplyHeaderType
{
   UINT8    bService;
   UINT8    bIoiSize;        /* Always 0 */

   UINT8    bGenStatus;
   UINT8    bObjStatusSize;  /* Usually 1 (but not always...) */
   LeUINT16 iLeObjStatus;
}
GNU_PACKED CI_LeBadReplyHeaderType;



/*---------------------------------------------------------------------------
**
** CI_LeKeyType
**
** Electronic key segment.
** Most commonly found hanging around in forward open packets.
**
**---------------------------------------------------------------------------
*/

typedef packet_struct CI_LeKeyType
{
   LeUINT16 iLeVendorId;
   LeUINT16 iLeProductType;
   LeUINT16 iLeProductCode;
   UINT8    bMajorRevision;
   UINT8    bMinorRevision;
}
GNU_PACKED CI_LeKeyType;


typedef packet_struct CI_KeyType
{
   UINT16  iVendorId;
   UINT16  iProductType;
   UINT16  iProductCode;
   BOOL    fUpdatesAllowed;
   UINT8   bMajorRevision;
   UINT8   bMinorRevision;
}
GNU_PACKED CI_KeyType;



/*---------------------------------------------------------------------------
**
** CI_PacketModeratorType
**
** Format of ControlNet moderator LPacket.
**
**---------------------------------------------------------------------------
*/

typedef packet_struct CI_PacketModeratorType
{
/* CI_FixedTagHeaderType sHeader; */

   UINT8 bNutTimeLo;
   UINT8 bNutTimeHi;
   UINT8 bSMax;
   UINT8 bUMax;
   UINT8 bSlotTime;
   UINT8 bBlankTime;
   UINT8 bGuardBandStart;
   UINT8 bGuardBandCenter;
   UINT8 bUnschedStart;
   UINT8 bNutNumber;
   UINT8 bNutMod;
   UINT8 bTMinusCount;
   UINT8 bGuardBandPrestart;
   UINT8 bReserved;
}
GNU_PACKED CI_PacketModeratorType;



/*---------------------------------------------------------------------------
**
** CI_PacketTMinusType
**
** Format of ControlNet T-Minus LPacket.
**
**---------------------------------------------------------------------------
*/

typedef packet_struct CI_PacketTMinusType
{
/* CI_FixedTagHeaderType sHeader; */

   UINT8 bTMinusCount;
   UINT8 abPad[ 3 ];
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -