回复:关于FOR/NEXT指令

shine

  • 帖子

    8803
  • 精华

    39
  • 被关注

    157

论坛等级:至圣

注册时间:2003-06-06

普通 普通 如何晋级?

发布于 2003-08-18 08:54:57

0楼

The FOR (FOR) instruction executes the instructions between the FOR and the NEXT. You specify the index value or current loop count (INDX), the starting value (INIT), and the ending value (FINAL).The NEXT (NEXT) instruction marks the end of the FOR loop, and sets the top of the stack to 1.Use the FOR/NEXT instructions to delineate a loop that is repeated for the specified count. Each FOR instruction requires a NEXT instruction. You can nest FOR/NEXT loops (place a FOR/NEXT loop within a FOR/NEXT loop) to a depth of eight.For example, given an INIT value of 1 and a FINAL value of 10, the instructions between the FOR and the NEXT are executed 10 times with the INDX value being incremented: 1, 2, 3, ...10.If the starting value is greater than the final value, the loop is not executed. After each execution of the instructions between the FOR and the NEXT instruction, the INDX value is incremented and the result is compared to the final value. If the INDX is greater than the final value, the loop is terminated.
评论
编辑推荐: 关闭

请填写推广理由:

本版热门话题

SIMATIC S7-200

共有33289条技术帖

相关推荐

热门标签

相关帖子推荐

guzhang

恭喜,你发布的帖子

评为精华帖!

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

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

  • 分享

  • 只看
    楼主

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