第5章S7300400件基础_第1页
第5章S7300400件基础_第2页
第5章S7300400件基础_第3页
第5章S7300400件基础_第4页
第5章S7300400件基础_第5页
已阅读5页,还剩61页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、date: 2022-2-4file no.: ssp1_03c.1simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation第第5章章 s7-300/400软件基础软件基础date: 2022-2-4file no.: ssp1_03c.2simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation5.1

2、s7-300的数据环境的数据环境5.2 逻辑操作指令逻辑操作指令5.3 程序控制指令程序控制指令5.4 传送和比较指令传送和比较指令5.5 运算指令运算指令5.6 转换指令转换指令 5.7 计数器指令计数器指令5.8 计时器指令计时器指令5.9 块操作指令块操作指令date: 2022-2-4file no.: ssp1_03c.3simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation5.1 s7-300的数据环境的数据环境1 数据类型数据类型

3、位位 bool 例:例: true 或或 false (1 或或0) 字节字节 byte 例:例: b#16#0ff 字字 word 例:例: w#16#0 ffff 双字双字 dword 例:例:dw#16#0ffff_ffff 整数整数 int 例:例:-3276832767 双整数双整数 dint 例:例:-214783648 214783647 实数实数 real real 例:例: 1.2 或或 34.5e-12 时间时间 s5time 例:例:s5t#2h5m (时基时基 10ms) 字符字符 char 例:例:a日期日期时间时间 time_of_day time_of_day 例

4、:例:tod#12:23:45.12tod#12:23:45.12 时间时间 time 例:例:t#20h_31m_23s (时基时基 1ms)日期日期 date 例:例:d#1990-1-1 (时基时基 1天天)date: 2022-2-4file no.: ssp1_03c.4simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation说明: s5time 为为 simatic时间时间 范围范围 s5t#0h_0m_0s_10ms s5t#2h_4

5、6m_39s_0mstime为为 iec时间时间 范围范围 t#0 0 0 . 0 t#23 59 59.999time-of-day 为为 日计时日计时 范围范围 tod#0:0:0.0 tod#23:59:59.999date: 2022-2-4file no.: ssp1_03c.5simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation2 过程映象过程映象字节 0字节 1字节 2: cpu 存储器区字节 0字节 1字节 2: piipiq

6、用户程序 cpu 存储器区 : :a i2.0= q4.3 : : : :11date: 2022-2-4file no.: ssp1_03c.6simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automationpscpusmsmsmsmsmsmsm模块 12 4 5 6 7 8 9 10槽号地址 0.0地址 0.7地址 1.0地址 1.7date: 2022-2-4file no.: ssp1_03c.7simatic s7siemens ag 2000.

7、 all rights reserved.information and training centerknowledge for automation3. step 7 的可能寻址范围的可能寻址范围设计的地址区设计的地址区 访问区域访问区域 缩写缩写 加在一起的最大区域加在一起的最大区域过程映象过程映象 i/q 输入 /输出位 i / q 0.0 - 65,535.7 输入 /输出字节 i/qb 0 - 65,535 输入 /输出字 i/qw 0 - 65,534 输入 /输出双字 i/qd 0 - 65,532存储器标志存储器标志 存储器位 m 0.0 - 255.7 存储器字节 mb 0

8、 - 255 存储器字 mw 0 - 254 存储器双字 md 0 - 252 i/q 外部输入外部输入/输出输出 i/q 字节, 外设 pib/pqb 0 - 65,535 i/q 字, 外设 piw/pqw 0 - 65,534 i/q 双字, 外设 pid/pqd 0 - 65,532 定时器定时器 定时器 (t) t 0 - 255计数器计数器 计数器 (c) c 0 - 255date: 2022-2-4file no.: ssp1_03c.8simatic s7siemens ag 2000. all rights reserved.information and training

9、 centerknowledge for automation设计的地址区设计的地址区 访问区域访问区域 缩写缩写 加在一起的最大区域加在一起的最大区域数据块数据块 数据块 (db) db 0 - 65,535数据块数据块 用opn db打开 位 dbx 0.0 - 65,535.7 字节 dbb 0 - 65,535 字 dbw 0 - 65,534 双字 dbd 0 - 65,532 用opn di打开 位 dix 0.0 - 65,535.7 字节 dib 0 - 65,535 字 diw 0 - 65,534 双字 did 0 - 65,532说明:db块包含由任意一个块存取的数据块包

10、含由任意一个块存取的数据.db块用块用“opn db”打开打开. di块用于存取与块用于存取与fb和和sfb块的数据块的数据. di块用块用“opn di” 打开打开. s7同时只能识别一个同时只能识别一个db块和一个块和一个di块的数据块的数据.date: 2022-2-4file no.: ssp1_03c.9simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation5.2 逻辑操作指令逻辑操作指令1. 位逻辑指令位逻辑指令(1)基本逻辑指令:)

11、基本逻辑指令:与与, , 或或date: 2022-2-4file no.: ssp1_03c.10simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation(2)基本逻辑指令:异或)基本逻辑指令:异或 (xor)date: 2022-2-4file no.: ssp1_03c.11simatic s7siemens ag 2000. all rights reserved.information and training centerknowled

12、ge for automation 异或异或 (xor(xor)指令练习:指令练习:date: 2022-2-4file no.: ssp1_03c.12simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation(3)常开和常闭触点,传感器和符号)常开和常闭触点,传感器和符号date: 2022-2-4file no.: ssp1_03c.13simatic s7siemens ag 2000. all rights reserved.informa

13、tion and training centerknowledge for automation 常开常闭触点练习常开常闭触点练习date: 2022-2-4file no.: ssp1_03c.14simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation与或非操作练习与或非操作练习date: 2022-2-4file no.: ssp1_03c.15simatic s7siemens ag 2000. all rights reserved.in

14、formation and training centerknowledge for automation(4)赋值,置位,复位)赋值,置位,复位date: 2022-2-4file no.: ssp1_03c.16simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation 置位复位操作练习置位复位操作练习date: 2022-2-4file no.: ssp1_03c.17simatic s7siemens ag 2000. all rights

15、reserved.information and training centerknowledge for automation(5 5)触发器的置位)触发器的置位 / / 复位复位date: 2022-2-4file no.: ssp1_03c.18simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation置位复位触发器练习置位复位触发器练习date: 2022-2-4file no.: ssp1_03c.19simatic s7siemens a

16、g 2000. all rights reserved.information and training centerknowledge for automation(6)中间输出操作中间输出操作ladi 1.0i 1.1( )m0.0i 2.0i 2.1( )m 1.1not( )q 4.0ai1.0ai1.1=m 0.0am 0.0ai2.0ai2.1not=m 1.1am 1.1=q 4.0stli 1.0i 1.1&i 2.0i 2.1m0.0m1.1q 4.0=fbddate: 2022-2-4file no.: ssp1_03c.20simatic s7siemens ag

17、 2000. all rights reserved.information and training centerknowledge for automation中间输出操作练习中间输出操作练习date: 2022-2-4file no.: ssp1_03c.21simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation(7 7) rlo - rlo - 边沿检测边沿检测 ( (检测确检测确 i1.0 i1.0与与i1.1i1.1的边沿的边沿) )

18、pi1.0i1.1m1.0m8.0ni1.0i1.1m1.1m8.1ladi1.0i1.1p=&m1.0m8.0i1.0i1.1n=&m1.1m8.1fbdai1.0 ai1.1fpm1.0=m8.0a i 1.0ai 1.1fnm1.1=m8.1stli1.0i1.1rlom1.0m8.0m8.1m1.1ob1-循环例如date: 2022-2-4file no.: ssp1_03c.22simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for aut

19、omation(8 8)信号)信号 - - 边沿检测边沿检测 (i1.0=1 (i1.0=1 时时 检测检测 i1.1i1.1的边沿的边沿) )i1.1=m8.0posm_bitm1.0&i1.0i1.1=m8.1negm_bitm1.1&i1.0fbdai1.0 a ( a i1.1fpm1.0)=m8.0ai1.0a(ai1.1fnm1.1)=m8.1stli1.1m8.0posm_bitm1.0qi1.0i1.1m8.1negm_bitm1.1qi1.0lad例如i1.0i1.1m1.0m8.0m8.1m1.1ob1-周期date: 2022-2-4file no.: s

20、sp1_03c.23simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation2 计数器线圈操作计数器线圈操作加计数加计数线圈线圈cu减计数减计数线圈线圈cd i0.0为置数脉冲为置数脉冲 i0.1为加计数脉冲为加计数脉冲 i0.2为减计数脉冲为减计数脉冲cv=0时时 c5=offcv 0时 c5=onq0.5=c5i1.0 =on时,时,i0.0=on时时cv=10。 i0.1脉冲使计数加脉冲使计数加1 i0.2脉冲使计数减脉冲使计数减1date:

21、 2022-2-4file no.: ssp1_03c.24simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation3 计时器线圈操作计时器线圈操作脉冲计时器(脉冲计时器( sp )i1.0 =on时时扩展脉冲计时器(扩展脉冲计时器( se )i1.0 =on时时计时器的数据格式:计时器的数据格式:date: 2022-2-4file no.: ssp1_03c.25simatic s7siemens ag 2000. all rights res

22、erved.information and training centerknowledge for automation开通延时计时器(开通延时计时器( sd )i1.0 =on时时保持型开通延时计时器(保持型开通延时计时器( ss )i1.0 =on时时关断延时计时器(关断延时计时器( sf )i1.0 =on时时date: 2022-2-4file no.: ssp1_03c.26simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation5.3

23、 程序控制指令程序控制指令(1)主控继电器功能主控继电器功能date: 2022-2-4file no.: ssp1_03c.27simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation主控继电器(主控继电器(mcr)是梯形逻辑主控开关,控制信号流的通断。)是梯形逻辑主控开关,控制信号流的通断。主控继电器的启动指令(主控继电器的启动指令(mcra)主控继电器的开通指令(主控继电器的开通指令(mcr)主控继电器的停止指令(主控继电器的停止指令(mcr

24、d)date: 2022-2-4file no.: ssp1_03c.28simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation主控继电器的例子主控继电器的例子1i0.0=on 执行执行“mcr”之间的指令。之间的指令。i0.0=off 不执行不执行“mcr”之间的指令。之间的指令。其中置位信号不变,其中置位信号不变, 赋值信号被复位。赋值信号被复位。date: 2022-2-4file no.: ssp1_03c.29simatic s7sie

25、mens ag 2000. all rights reserved.information and training centerknowledge for automation主控继电器的例子主控继电器的例子2date: 2022-2-4file no.: ssp1_03c.30simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation(2)无条件跳转无条件跳转指令指令date: 2022-2-4file no.: ssp1_03c.31simat

26、ic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation(3)条件跳转条件跳转指令指令date: 2022-2-4file no.: ssp1_03c.32simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation跳转跳转指令练习指令练习 (跳过之处不扫描)date: 2022-2-4file no.: ssp1_

27、03c.33simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation5.4 传送和比较指令传送和比较指令传送指令传送指令 字节,字,双字字节,字,双字传送。传送。比较指令比较指令整数,双整数,实数比较。整数,双整数,实数比较。比较符比较符:eq_i, ne_i, gt_i,eq_i, ne_i, gt_i,lt_i, ge_i, le_i.lt_i, ge_i, le_i.eq_d, ne_d, gt_d,eq_d, ne_d, gt_d,lt_d

28、, ge_d, le_d.lt_d, ge_d, le_d.eq_r, ne_r, gt_r,eq_r, ne_r, gt_r,lt_r, ge_r, le_r.lt_r, ge_r, le_r.date: 2022-2-4file no.: ssp1_03c.34simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation5.5 运算指令运算指令整数运算整数运算运算符:运算符:add_i. sub_i.mul_i. div_i.add_di. sub

29、_di.mul_di. div_di, mod_di.实数运算实数运算运算符:运算符:add_r. sub_r. mul_r. div_r.sin, cos,tan,asin, acos, atan,ln, expdate: 2022-2-4file no.: ssp1_03c.35simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation5.6 转换指令转换指令bcd码与整数转换码与整数转换 bcd_i把通道中把通道中的的bcd码码转换为整数存转换

30、为整数存入入通道通道中。中。 i_ bcd把通道中的把通道中的整数转换为整数转换为bcd码码存入存入通道通道中。中。双整数与实数转换双整数与实数转换di _rroundbcd_di, di _ bcd ,i _ di , di _i 。date: 2022-2-4file no.: ssp1_03c.36simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation5.7 计数器指令计数器指令双向计数器双向计数器i0.0为加计数脉冲为加计数脉冲i0.1为

31、减计数脉冲为减计数脉冲i0.2为置数脉冲为置数脉冲i0.3为复位脉冲为复位脉冲cv0时,时,c0=on。向上计数器向上计数器i0.0为加计数脉冲为加计数脉冲i0.1为置数脉冲为置数脉冲i0.2为复位脉冲为复位脉冲cv0时,时,c0=on。date: 2022-2-4file no.: ssp1_03c.37simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation向下计数器向下计数器i0.3为减计数脉冲为减计数脉冲i0.4为置数脉冲为置数脉冲i0.5

32、为复位脉冲为复位脉冲cv0时,时,c0=on。说明:梯形图中梯形图中cv为用十六进制表示的计数器的当前值。为用十六进制表示的计数器的当前值。梯形图中梯形图中cv_ bcd为用为用bcd码表示的计数器的当前值。码表示的计数器的当前值。梯形图中的梯形图中的pv值可以用值可以用bcd码表示的数值由通道送入。码表示的数值由通道送入。date: 2022-2-4file no.: ssp1_03c.38simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation

33、5.8 计时器指令计时器指令脉冲计时器(脉冲计时器(sp)扩展脉冲计时器(扩展脉冲计时器(se)date: 2022-2-4file no.: ssp1_03c.39simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation开通延时计时器(开通延时计时器(sd)保持型开通延时计时器(保持型开通延时计时器(ss)date: 2022-2-4file no.: ssp1_03c.40simatic s7siemens ag 2000. all right

34、s reserved.information and training centerknowledge for automation关断延时计时器(关断延时计时器(sf)说明:梯形图中梯形图中bi为用十六进制表示的计数器的当前值。为用十六进制表示的计数器的当前值。梯形图中梯形图中 bcd为用为用bcd码表示的计数器的当前值。码表示的计数器的当前值。梯形图中的梯形图中的tv值可以用值可以用bcd码表示的数值由通道送入。码表示的数值由通道送入。date: 2022-2-4file no.: ssp1_03c.41simatic s7siemens ag 2000. all rights reser

35、ved.information and training centerknowledge for automation5.9 块操作指令块操作指令1 温度控制(温度控制(s7-pro1)说明:检测温度在说明:检测温度在piw256中,显示在中,显示在pqw368中。中。 温控温控1的温度保持在的温度保持在82,控制器为控制器为q 0.0 。 温控温控2的温度保持在的温度保持在182,控制器为控制器为q 0.1 。设计:设计:ob1为主程序,负责调用控制程序为主程序,负责调用控制程序fc1。 db1和和db2为通用数据块。为通用数据块。 其中其中db1为温控为温控1的控制参数数据块。的控制参数数

36、据块。 db2为温控为温控2的控制参数数据块。的控制参数数据块。date: 2022-2-4file no.: ssp1_03c.42simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automationdb块:块:db1db2date: 2022-2-4file no.: ssp1_03c.43simatic s7siemens ag 2000. all rights reserved.information and training centerknowle

37、dge for automationfc块:块:fc1date: 2022-2-4file no.: ssp1_03c.44simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automationob块:块:ob1date: 2022-2-4file no.: ssp1_03c.45simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for

38、automation运行仿真:运行仿真:温控温控1控制仿真控制仿真温控温控2控制仿真控制仿真date: 2022-2-4file no.: ssp1_03c.46simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation2 温度控制(温度控制(s7-pro2)说明:检测温度在说明:检测温度在piw256中,显示在中,显示在pqw368中。中。 温控温控1的温度保持在的温度保持在82,控制器为控制器为q 0.0 。 温控温控2的温度保持在的温度保持在1

39、82,控制器为控制器为q 0.1 。设计:设计:ob1为主程序,负责调用控制程序为主程序,负责调用控制程序fb1。 db1和和db2为为fb1型数据块。型数据块。 其中其中db1为温控为温控1的控制参数数据块。的控制参数数据块。 db2为温控为温控2的控制参数数据块。的控制参数数据块。date: 2022-2-4file no.: ssp1_03c.47simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automationfb块:块:fb1date: 2022-

40、2-4file no.: ssp1_03c.48simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automationdb块:块:db1db2date: 2022-2-4file no.: ssp1_03c.49simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automationob块:块:ob1date: 2022-2-4fi

41、le no.: ssp1_03c.50simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation运行仿真:运行仿真:温控温控1控制仿真控制仿真温控温控2控制仿真控制仿真date: 2022-2-4file no.: ssp1_03c.51simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automation3温度控制(

42、温度控制(s7-pro3)说明:检测温度在说明:检测温度在piw256中,显示在中,显示在pqw368中。中。 温控温控1的温度保持在的温度保持在82,控制器为控制器为q 0.0 。 温控温控2的温度保持在的温度保持在182,控制器为控制器为q 0.2 。 温控温控3的温度保持在的温度保持在282,控制器为控制器为q 0.4 。设计:设计:ob1为主程序,负责调用控制程序为主程序,负责调用控制程序fb1和和fc1。 db1和和db2为为fb1型数据块。型数据块。 其中其中db1为温控为温控1的控制参数数据块。的控制参数数据块。 db2为温控为温控2的控制参数数据块。的控制参数数据块。 db3为

43、通用数据块,为温控为通用数据块,为温控3的控制参数。的控制参数。 fb1控制温度控制温度1,2。fc1控制温度控制温度3 。date: 2022-2-4file no.: ssp1_03c.52simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automationfc块:块:fc1date: 2022-2-4file no.: ssp1_03c.53simatic s7siemens ag 2000. all rights reserved.informatio

44、n and training centerknowledge for automationfb块:块:fb1date: 2022-2-4file no.: ssp1_03c.54simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automationdb块:块:db1db2date: 2022-2-4file no.: ssp1_03c.55simatic s7siemens ag 2000. all rights reserved.information and

45、 training centerknowledge for automationdb3date: 2022-2-4file no.: ssp1_03c.56simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automationob块:块:ob1date: 2022-2-4file no.: ssp1_03c.57simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for automationob1续续运行仿真:运行仿真:i0.0,i0.1=on: piw25610 q0.0=off.i0.2,i0.3=on: piw25620 q0.2=off.i0.3,i0.4=on: piw25630 q0.4=off.date: 2022-2-4file no.: ssp1_03c.58simatic s7siemens ag 2000. all rights reserved.information and training centerknowledge for a

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论