菜鸟求大侠帮我给这段代码加个注释~~感激不尽T T
#TCon_Param.CONNECTION_TYPE:=#TCon_Param.CONNECTION_TYPE;
#TCon_Param.REM_STADDR_LEN:=4;
#TCon_Param.REM_STADDR[1] := #REM_IP1;
#TCon_Param.REM_STADDR[2] := #REM_IP2;
#TCon_Param.REM_STADDR[3] := #REM_IP3;
#TCon_Param.REM_STADDR[4] := #REM_IP4;
#TCon_Param.LOCAL_TSAP_ID_LEN := 2;
#TCon_Param.REM_TSAP_ID_LEN := 0;
#port:=#port;
#TCon_Param.LOCAL_TSAP_ID[1]:=#port.B1;
#TCon_Param.LOCAL_TSAP_ID[2]:=#port.B0;
#TCon_Param.ID := #ID;
// TCON
#TCON_Instance(REQ:="Communication_Contrl".Com_REQ,
ID:=#TCon_Param.ID,
DONE=>#TCon_Done,
BUSY=>#TCon_Busy,
ERROR=>#TCon_Error,
STATUS=>#TCon_Status,
CONNECT:=#TCon_Param);
// TRCV
#TRCV_Instance(EN_R:=TRUE,
ID:=#TCon_Param.ID,
LEN:=0,
NDR=>#TRcv_Done,
BUSY=>#TRcv_Busy,
ERROR=>#TRcv_Error,
STATUS=>#TRcv_Status,
RCVD_LEN=>#RCVD_LEN,
DATA:=#ReceiveStructure);
// TSEND
#TSEND_Instance(REQ:=#TSend_Req,
ID:=#TCon_Param.ID,
LEN:=0,
DONE=>#TSend_Done,
BUSY=>#TSend_Busy,
ERROR=>#TSend_Error,
STATUS=>#TSend_Status,
DATA:=#SendStructure);
// Schrittkette Communication
CASE #Step_Communication OF
// Connection established?
0: IF #TCon_Done THEN
#Step_Communication := 1;
END_IF;;
// Data received?
1: IF #TRcv_Done THEN
#Step_Communication := 2;
END_IF;
// sending data
2: #TSend_Req := true;
#Step_Communication := 3;
// data sent ?
3: IF #TSend_Done THEN
#Step_Communication := 4;
END_IF;
// reset param.
4: #TSend_Req := false;
#Step_Communication := 1;
END_CASE;
最佳答案
注释没办法告诉你,因为有临时或静态变量的存在,只能根据程序分析,判断每个变量所存储的数据进而得出它的含义。并且你的程序不是完整的。
你要先学习SCL方面的知识。调用的块是用于集成 PROFINET 接口开放式用户以太网通讯做数据交换。
提问者对于答案的评价:
下了点SCL的资料,我学学,3Q
专家置评
已阅,最佳答案正确。
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc204411.html