有个项目是JX-300XP。有有一 块XP248通信卡,一个电量集中显示仪表是,MODBUS ASCII,要自己写协议,现在仪表积存器地址,帮助,通讯协议已经写好,可我看不 明白,请高手加我QQ49402812,解答一下,万分感激!在线等?
UNCTION_BLOCK receivemsg
VAR_INPUT (*输入管脚定义*)
CMDID:BYTE;
END_VAR
VAR_OUTPUT (*输出管脚定义*)
TEMP1_1: BYTE;
TEMP1_2: BYTE;
TEMP1_3: BYTE;
TEMP1_4: BYTE;
TEMP1_5: BYTE;
TEMP1_6: BYTE;
TEMP1_7: BYTE;
TEMP1_8: BYTE;
TEMP1_9: BYTE;
TEMP1_10: BYTE;
TEMP1_11: BYTE;
TEMP1_12: BYTE;
TEMP1_13: BYTE;
TEMP1_14: BYTE;
TEMP1_15: BYTE;
TEMP1_16: BYTE;
END_VAR
VAR
DATALEN: UINT;
RCVBUF: ULONG;
END_VAR
DATALEN = GW_GETRCVLEN(CMDID);
IF DATALEN > 0 THEN
RCVBUF = GW_GETRCVMSG(CMDID);
TEMP1_1 = GW_READBUF(RCVBUF,7);
TEMP1_2 = GW_READBUF(RCVBUF,8);
TEMP1_3 = GW_READBUF(RCVBUF,9);
TEMP1_4 = GW_READBUF(RCVBUF,10);
TEMP1_5 = GW_READBUF(RCVBUF,11);
TEMP1_6 = GW_READBUF(RCVBUF,12);
TEMP1_7 = GW_READBUF(RCVBUF,13);
TEMP1_8 = GW_READBUF(RCVBUF,14);
TEMP1_9 = GW_READBUF(RCVBUF,15);
TEMP1_10 = GW_READBUF(RCVBUF,16);
TEMP1_11 = GW_READBUF(RCVBUF,17);
TEMP1_12 = GW_READBUF(RCVBUF,18);
TEMP1_13 = GW_READBUF(RCVBUF,19);
TEMP1_14 = GW_READBUF(RCVBUF,20);
TEMP1_15 = GW_READBUF(RCVBUF,21);
TEMP1_16 = GW_READBUF(RCVBUF,22);
END_IF;
END_FUNCTION_BLOCK
这是读取表里一个积存器的,请高手解答一下?
楼主最近还看过