回复:FC重复调用时,DB块作为OUT实参出现相互干扰问题分析

Qxlyshy

  • 帖子

    22
  • 精华

    0
  • 被关注

    27

论坛等级:侠客

注册时间:2016-09-17

普通 普通 如何晋级?

发布于 2017-04-12 14:10:38

4楼

展开查看
以下是引用唐诗宋瓷在2017-04-11 21:35:21的发言 >2楼

*哎,什么值来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堆栈赋值问题,比较隐蔽),但是因为隐藏得很深,可能忽略。

试试才知道,你是否是我的想要
评论
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC S7-300/400

共有54768条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

快扫描右侧二维码晒一晒吧!

再发帖或跟帖交流2条,就能晋升VIP啦!开启更多专属权限!

  • 分享

  • 只看
    楼主

top
X 图片
您收到0封站内信:
×
×
信息提示
很抱歉!您所访问的页面不存在,或网址发生了变化,请稍后再试。