恭喜,你发布的帖子
发布于 2017-04-12 14:10:38
4楼
*哎,什么值来L栈中放?
The L stack saves the following:
The temporary variables of the local data of blocks
The start information of the organization blocks
Information about transferring parameters
Interim results of the logic in Ladder Logic programs
*哎,L栈中值来何时变?
When you are programming organization blocks, you can declare temporary variables (TEMP) that are only available when the block is executed and are then overwritten again.
*哎,L栈中值来如何用?
Before you access the local data stack for the first time, the local data must be initialized.
*哎,用到TEMP要小心啊,要小心!
Caution
When using temporary variables, remember that they are only valid within the relevant block or are only available as previous local data for other blocks called in this block. In particular, there is no guarantee that if you close and then re-open the block, the temporary variables will have the same values they had when the previous block call was completed. Temporary variables are by definition undetermined when a block is called and must be re-initialized again when they are used for the first time in the block.
All the temporary variables (TEMP) of an OB and its associated blocks are saved in the L stack. If you use too many nesting levels when executing your blocks, the L stack can overflow.
S7 CPUs change to STOP mode if the permitted L stack size for a program is exceeded.
Test the L stack (the temporary variables) in your program.
The local data requirements of synchronous error OBs must be taken into consideration.
L中放值不详细,要知详细要试验。
M试完哟不再看,可知常数怎么办?!
涉及到使用临时变量,大家都知道的原则是先赋值,再调用。总结这个帖子的目的就是想说明一下,在重复调用FC函数时,涉及到输出接口OUT的,可能全程并未使用过临时变量(可以查看开头的例子),但是还是出现了输出结果错误的问题,虽然问题实质还是临时变量的问题(OB1的L堆栈赋值问题,比较隐蔽),但是因为隐藏得很深,可能忽略。
请填写推广理由:
分享
只看
楼主