谁可以帮我解释下这MCGS程序?最后三个ENDIF怎么理解?和那段程序一起看?
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/09 10:47:50
谁可以帮我解释下这MCGS程序?最后三个ENDIF怎么理解?和那段程序一起看?
IF T1GMXW = 1 THEN
IF T1C2 = 1 THEN '由T1C1前往 T1C2
T1C1XW = 0
IF T1C1 = 0 AND ( T1C2 = 1 OR T1S2 = 1 ) AND T1C3 = 0 AND T1C4 = 0 AND T1C1XW = 0 THEN
定时器启动16 = 1
定时器复位16 = 0
IF 计时时间16 > 0 AND 计时时间16 < 4 THEN
CZYDL1 = CZYDL1 - 1
ENDIF
IF 时间到16 = 1 THEN
定时器复位16 = 1
定时器启动16 = 0
T1C2 = 0
T1C2XW = 1
T1C1ZS = 0
T1C2ZS = 1
ENDIF
ENDIF
ENDIF
IF T1GMXW = 1 THEN
IF T1C2 = 1 THEN '由T1C1前往 T1C2
T1C1XW = 0
IF T1C1 = 0 AND ( T1C2 = 1 OR T1S2 = 1 ) AND T1C3 = 0 AND T1C4 = 0 AND T1C1XW = 0 THEN
定时器启动16 = 1
定时器复位16 = 0
IF 计时时间16 > 0 AND 计时时间16 < 4 THEN
CZYDL1 = CZYDL1 - 1
ENDIF
IF 时间到16 = 1 THEN
定时器复位16 = 1
定时器启动16 = 0
T1C2 = 0
T1C2XW = 1
T1C1ZS = 0
T1C2ZS = 1
ENDIF
ENDIF
ENDIF
一个IF必须对应一个ENDIF,你前面有3个IF,所以最后有三个ENDIF!这个程序好像是单片机的,我不太懂!