欢迎光临散文网 会员登陆 & 注册

S7-300 STL 简单程序编写和仿真

2022-12-07 18:38 作者:3_qq_3  | 我要投稿

程序概览

地址分配

 数据块 motor 地址分配

Static

i0.0 Bool 0.0 false True True False PEB1 光电传感器

i0.1 Bool 0.1 false True True False PEB2 光电传感器

q4.0 Bool 0.2 false True True False 向右运动显示  right

q4.1 Bool 0.3 false True True False 向左动动显示 left

m0.0 Bool 0.4 false True True False PMB1 脉冲存储存位

m0.1 Bool 0.5 false True True False PMB2 脉冲存储存位

BTN0 Bool 0.6 false True True False

BTN1 Bool 0.7 false True True False

Flage0 Bool 1.0 false True True False

Flage1 Bool 1.1 false True True False

motor0_FB  程序

程序段1

水平方向安装两只光电,当传送带的包裹检从左测经过光电时左测选检测到包裹此时右测光电无信号

当传送带的包裹检从右侧经过光电时左侧光电选检测到包裹此时右测光电无信号


      A     "motor"."i0.1"

      FP    "motor"."m0.0"

      AN    "motor"."i0.0"

      S     "motor"."q4.1"


      A     "motor"."i0.0"

      FP    "motor"."m0.1"

      AN    "motor"."i0.1"

      S     "motor"."q4.0"


      AN    "motor"."i0.0"

      AN    "motor"."i0.1"

      R     "motor"."q4.0"

      R     "motor"."q4.1"

程序段2   Simple AND and AND NOT Operation

      A     "motor".BTN0

      AN    "motor".BTN1

      =     "motor".Flage0

// "motor".Flage0 := "motor".BTN0 AND  NOT "motor".BTN1

程序段3 Simple OR and OR  NOT Operation

      O     "motor".BTN0

      ON    "motor".BTN1

      =     "motor".Flage1

      =     "Tag_9"

// "motor".Flage1 := "motor".BTN0 OR  NOT "motor".BTN1

仿真时,在仿真字窗口插入 通用变量就可以修改 DB块中变量的值了。

在模拟器中对DB块进行监视


S7-300 STL 简单程序编写和仿真的评论 (共 条)

分享到微博请遵守国家法律