Example Of High-Speed Output Using Pulse Width Modulation - Siemens SIMATIC S7-200 System Manual

Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

Example of Pulse Width Modulation
Figure 9-21 shows an example of the Pulse Width Modulation.
MAIN OB1
Network 1
SM0.1
Network 2
M0.0
.
.
SUBROUTINE 0
Network 1
SM0.0
16#DB
10000
.
.
16#DA
SUBROUTINE 1
SM0.0
Figure 9-21
S7-200 Programmable Controller System Manual
A5E00066097-02
LAD
Q0.1
On the first scan, set
R
image register bit low, and
1
call subroutine 0.
SBR0
EN
When pulse width change to
50% duty cycle is required,
SBR1
M0.0 is set.
P
EN
End of main ladder.
Start of subroutine 0.
Set up control byte:
MOV_B
- select PWM operation
EN
ENO
- select ms increments
IN
OUT
SMB77
- set the pulse width and
MOV_W
- enable the PWM function
EN
ENO
Set cycle time to
IN
OUT
SMW78
10,000 ms.
MOV_W
EN
ENO
Set pulse width to
1,000 ms.
1000
IN
OUT
SMW80
Invoke PWM operation.
PLS
PLS 1 => Q0.1
EN
ENO
1
Q0.x
Preload control byte for
MOV_B
subsequent pulse width
EN
ENO
changes.
IN
OUT
SMB77
Start of subroutine 1
MOV_W
Set pulse width to 5000 ms
EN
ENO
SMW80
IN
OUT
5000
Assert pulse width change.
PLS
EN
ENO
1
Q0.X

Example of High-Speed Output Using Pulse Width Modulation

Network 1
LD
R
CALL
Network 2
LD
EU
CALL
.
.
Network 1
LD
synchronous updates
MOVB
MOVW
cycle time values
MOVW
PLS
MOVB
.
.
.
Network 1
LD
MOVW
PLS
SIMATIC Instructions
STL
SM0.1
Q0.1, 1
0
M0.0
1
SM0.0
16#DB, SMB77
10000, SMW78
1000, SMW80
1
16#DA, SMB77
SM0.0
5000, SMW80
1
9-63

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents