恭喜,你发布的帖子
发布于 2017-11-21 14:57:39
59楼
看了楼主和Letham版主的程序贴图,前者是FC+DB,但DB是设置为不保持的,后者是FB,但所有变量都设置为保持的;
断电重启后,该功能块的输出是做如何反应,二位能否说明一下?
1.3 Initialization Implementing an initialization sequence It is usually required to initialize various parameters at the initial call of your block. The block may also contain additional tasks it only has to execute once, depending on the technological function of your block. If this is the case in your block you must implement an initial startup sequence. This is done by defining a BOOLEAN variable, for example sbRESTART, which can be implemented as static variable. Your block is not only initialized when you restart the system, but also when you reload it while the CPU is in RUN. It is for this reason that you have to integrate the initial startup sequence in the cyclic section of your block. You may therefore, if necessary, distribute the initial startup sequence to several call cycles of the block. //**************************************************************************** // Dependency on the calling OB //**************************************************************************** // Reading the start info by calling SFC6 (RD_SINFO)
DUMMY := RD_SINFO (TOP_SI := TOP_SI, START_UP_SI := START_UP_SI);
IF sbRESTART THEN // Initialization sequence
TOP_SI.NUM := 100; // Execution of the initialization sequence as restart
sbRESTART := FALSE; // Reset initialization sequence
END_IF;
// Which OB called the block?
CASE WORD_TO_INT(BYTE_TO_WORD(TOP_SI.NUM)) OF //****************************************************************************
// Handling of error OBs //****************************************************************************
// OB80: Timeout error
80: QH_ALM := 0;
// Reset error outputs
QL_ALM := 0; //****************************************************************************
// Startup
//****************************************************************************
// OB100: Restart
100: QH_ALM := 0;
// Reset error outputs
QL_ALM := 0;
siRUNUPCNT := RUNUPCYC; // Save RUNUPCYC value
请填写推广理由:
分享
只看
楼主