准备材料:
硬件: 电脑、大屏幕
软件:组态王6.5 step7 v4.0 虚拟串口软件Virtual_Serial_Port_Driver_Ver7.2 pj.rar
北京华晟云联IASIMU107B.exe
灯光效果:随着音乐,组态王中设置的灯按照要求亮起
实施过程:
1.按照流程图在step7中,编制程序完成并导出文件。*.awl文件。
2.在组态王中按图给定放置画出图形界面、连接变量。
3.打开虚拟串口软件、设置虚拟串口。
4..打开IASIMU107B.exe 仿真程序打开*.awl文件。同时在设置串口处,将串口配对。
5、运行组态王、运行仿真plc、将虚拟plc打到run,
组态王和仿真程序建立通信,可以看到灯光效果。
0 ORGANIZATION_BLOCK 主程序:OB1
1 BEGIN
2 Network 1
3 Network 2
4 LD SM0.1
5 S M0.0, 1
6 Network 3
7 LD M0.0
8 MOVB 0, SB0
9 MOVB 0, SB1
10 MOVB 0, SB2
11 MOVB 0, SB3
12 BMB SB0, QB2, 4
13 MOVB 2#10000000, QB0
14 TON T41, 10
15 Network 4
16 LD I0.0
17 O T41
18 S M0.1, 1
19 R M0.0, 1
20 Network 5
21 LD M0.1
22 LPS
23 MOVB 2#11111111, QB2
24 AW= T37, 1
25 MOVB 2#11000000, QB0
26 LPP
27 TON T37, 50
28 Network 6
29 LD I0.1
30 O T37
31 R M0.1, 1
32 S M0.2, 1
33 Network 7
34 LD M0.2
35 LPS
36 MOVB 2#11111111, QB3
37 AW= T38, 1
38 MOVB 2#100000, QB0
39 LPP
40 TON T38, 50
41 Network 8
42 LD I0.2
43 O T38
44 R M0.2, 1
45 S M0.3, 1
46 Network 9
47 LD M0.3
48 LPS
49 AW= T39, 3
50 MOVB 2#11111111, QB4
51 MOVB 0, QB2
52 LPP
53 MOVB 2#10000, QB0
54 TON T39, 50
55 Network 10
56 LD I0.3
57 O T39
58 R M0.3, 1
59 S M0.4, 1
60 Network 11
61 Network 12
62 LD M0.4
63 LPS
64 MOVB 0, QB3
65 AENO
66 = L63.7
67 LRD
68 MOVB 0, QB2
69 AENO
70 O L63.7
71 MOVB 2#11111111, QB5
72 LPP
73 LPS
74 AW>= T40, 4
75 MOVB 2#1000, QB0
76 LPP
77 TON T40, 20
78 Network 13
79 LD I0.4
80 O T40
81 R M0.4, 1
82 S M1.0, 1
83 Network 14
84 LD M1.0
85 MOVB 2#11111111, QB2
86 MOVB 2#11111111, QB3
87 TON T47, 10
88 Network 15
89 LD T47
90 R M1.0, 1
91 S M0.5, 1
92 Network 16
93 LD M0.5
94 LPS
95 A T42
96 ED 0
97 SLB QB2, 1
98 SLB QB3, 1
99 SLB QB4, 1
100 SLB QB5, 1
101 MOVB 2#0, QB0
102 LPP
103 LPS
104 AN T42
105 TON T42, 20
106 LPP
107 TON T43, 200
108 Network 17
109 LD T43
110 S M0.6, 1
111 R M0.5, 1
112 Network 18
113 LD M0.6
114 LPS
115 A T45
116 EU 1
117 SHRB SM0.0, Q2.0, 32
118 LRD
119 TON T44, 400
120 LPP
121 AN T45
122 TON T45, 10
123 Network 19
124 LD T44
125 S M0.0, 1
126 R M0.6, 1
127 END_ORGANIZATION_BLOCK 135
128 SUBROUTINE_BLOCK SBR_0:SBR0
129 BEGIN
130 Network 1
131 END_SUBROUTINE_BLOCK 0
132 INTERRUPT_BLOCK INT_0:INT0
133 BEGIN
134 Network 1
135 END_INTERRUPT_BLOCK 0