| | |
| | | /*
|
| | | /*
|
| | |
|
| | |
|
| | |
|
| | |
| | |
|
| | | };
|
| | |
|
| | | enum enInputFilter
|
| | | {
|
| | | InputFilter_None = 0,
|
| | | InputFilter_1mS = 1,
|
| | | InputFilter_2mS = 2,
|
| | | InputFilter_4mS = 3,
|
| | | InputFilter_8mS = 4,
|
| | | InputFilter_16mS = 5,
|
| | | InputFilter_32mS = 6,
|
| | | InputFilter_64mS = 7,
|
| | | InputFilter_128mS = 8,
|
| | | InputFilter_256mS = 9,
|
| | | };
|
| | |
|
| | | enum enOutputHold
|
| | | {
|
| | | Output_Hold = 0,
|
| | | Output_Set_0 = 1,
|
| | | Output_Set_1 = 2,
|
| | | };
|
| | |
|
| | | enum enPortType
|
| | | {
|
| | | PortType_Com = 0, //¼ÆËã»úͨѶ
|
| | | PortType_Gen = 1, //ͨÓÃͨѶ£¬×ÔÓÉ¿Ú
|
| | | PortType_KLink = 2, //KlinkͨѶ
|
| | | PortType_KBus = 3, //KBusͨѶ
|
| | | PortType_KNet = 4, // KNetͨѶ
|
| | | PortType_ModbusRTU = 5, //Modbus RTU ͨѶ
|
| | | };
|
| | |
|
| | | enum enKeventType
|
| | | {
|
| | | EventTypeNone = 0,
|
| | | EventTypePowerUp = 1,
|
| | | EventTypePowerDown = 2,
|
| | | EventTypePowerRecover = 3,
|
| | | EventTypeConnected = 4,
|
| | | EventTypeLostCon = 5,
|
| | | EventTypeSetTime = 6,
|
| | | EventTypeSysCfg = 7,
|
| | | EventTypeProg = 8,
|
| | | EventTypeForce = 9,
|
| | | EventTypeClearEvent = 10,
|
| | |
|
| | |
|
| | | EventType
|
| | | };
|
| | | typedef struct tagInfoBlock
|
| | | {
|
| | | USHORT nDeviceType;
|
| | | USHORT ProgVer;
|
| | | USHORT KlinkVer;
|
| | | USHORT nCapacity;
|
| | | UCHAR nDInput;
|
| | | UCHAR nDOutput;
|
| | | UCHAR nAInput;
|
| | | UCHAR nAOutput;
|
| | | UCHAR nHInput;
|
| | | UCHAR nHOutput;
|
| | | UCHAR nExt1;
|
| | | UCHAR nEXT2;
|
| | |
|
| | | }stKMInfoBlock;
|
| | |
|
| | | typedef struct tagKMFuncParam
|
| | | {
|
| | | USHORT EnablePLC : 1; //使能内部PLC功能
|
| | | USHORT RunMode; //工作模式
|
| | | }stKMFuncParam;
|
| | |
|
| | | //输入输出地址映射
|
| | | typedef struct tagAddrMapping
|
| | | {
|
| | | USHORT InputAddr;
|
| | | USHORT OutputAddr;
|
| | | USHORT WRAddr;
|
| | | USHORT DTAddr;
|
| | | }stAddrMapping;
|
| | | typedef struct tagComPortParam
|
| | | {
|
| | | USHORT PortType : 4; /* 0-5=Com,Gen,KLink,KBus,KNet,RTU */
|
| | | USHORT ByteSize : 2; /* 0-1=Number of bits/byte, 7-8 */
|
| | | USHORT Parity : 4; /* 0-4=None,Odd,Even,Mark,Space */
|
| | | USHORT StopBits : 2; /* 0,1,2 = 1, 1.5, 2 */
|
| | | USHORT EofChar : 2; /* 0,1,2 = None, CR, CR+LF, ETX; End of character */
|
| | | USHORT SofChar : 2; /* 0,1,2 = None, STX */
|
| | | USHORT BaudRate; /* =*100 Baudrate at which running */
|
| | | }stComPortParam;
|
| | |
|
| | | typedef struct tagInputFilterParam
|
| | | {
|
| | | BYTE Filter0 : 4;
|
| | | BYTE Filter1 : 4;
|
| | |
|
| | | }stInputFilterParam;
|
| | |
|
| | | typedef struct tagOutputHoldParam
|
| | | {
|
| | | BYTE Hold1 : 4;
|
| | | BYTE Hold2 : 4;
|
| | | }stOutputHoldParam;
|
| | | // 硬件描述文件
|
| | |
|
| | | typedef struct tagMSysCfg
|
| | | {
|
| | | unsigned short Sign1; //2
|
| | | unsigned short Seq1; //2
|
| | | UINT cfgvar2; //4
|
| | | stComPortParam Ports[2]; //2*4B
|
| | | stOutputHoldParam OutputParams[16]; //16B
|
| | | stInputFilterParam InputParams[16]; //16B
|
| | |
|
| | | UINT cfgvar3;
|
| | | UINT cfgvar4;
|
| | | UINT cfgvar5;
|
| | | UINT cfgvar6;
|
| | | UINT cfgvar7;
|
| | | UINT cfgvar8;
|
| | | UINT cfgvar9;
|
| | | UINT cfgvar10;
|
| | | UINT cfgvar11;
|
| | | UINT cfgvar12;
|
| | | UINT cfgvar13;
|
| | | UINT cfgvar14;
|
| | | UINT cfgvar15;
|
| | | UINT cfgvar16; //14*4 56B
|
| | | UINT Space1[5]; // 20B
|
| | |
|
| | | unsigned short CRC1; //2B
|
| | | unsigned short EndSign1; //2B
|
| | | }stKMSysCfg, *pKMSysCfg; //128B
|
| | |
|
| | |
|
| | | typedef struct tagTimer
|
| | |
| | | unsigned short nParamAddr;
|
| | | }stBinProg1;
|
| | | typedef struct stBinProg15
|
| | | { //定时器
|
| | | //单参数高级指令
|
| | | { //定时器
|
| | | //单参数高级指令
|
| | | unsigned char nOp;
|
| | | unsigned char nOpNum;
|
| | | unsigned short nParamAddr1;
|
| | |
| | | unsigned short resvr2;
|
| | | }stBinProg15;
|
| | | typedef struct stBinProg2
|
| | | { //比较指令
|
| | | //双参数高级指令
|
| | | { //比较指令
|
| | | //双参数高级指令
|
| | | unsigned char nOp;
|
| | | unsigned char nOpNum;
|
| | | unsigned short nParamAddr1;
|
| | |
| | | unsigned short nParamAddr2;
|
| | | }stBinProg2;
|
| | | typedef struct stBinProg3
|
| | | { //三参数高级指令
|
| | | { //三参数高级指令
|
| | | unsigned char nOp;
|
| | | unsigned char nOpNum;
|
| | | unsigned short nParamAddr1;
|