Specifications

SIMATIC Instructions
9-63
S7-200 Programmable Controller System Manual
C79000-G7076-C233-01
Example of Pulse Width Modulation
Figure 9-21 shows an example of the Pulse Width Modulation.
Network 1
LD SM0.1
R Q0.1, 1
CALL 0
Network 2
LD M0.0
EU
CALL 1
.
.
Network 1
LD SM0.0
MOVB 16#DB, SMB77
MOVW 10000, SMW78
MOVW 1000, SMW80
PLS 1
MOVB 16#DA, SMB77
.
.
.
IN16#DB
MOV_B
OUT SMB77
EN
SM0.0
IN10000
MOV_W
OUT SMW78
EN
Set pulse width to
1,000 ms.
Set cycle time to
10,000 ms.
IN1000
MOV_W
OUT SMW80
EN
PLS
EN
Invoke PWM operation.
PLS 1 => Q0.1
Network 1
Start of subroutine 0.
Q0.x1
Set up control byte:
- select PWM operation
- select ms increments
synchronous updates
- set the pulse width and
cycle time values
- enable the PWM function
R
Network 1
SM0.1
On the first scan, set
image register bit low, and
call subroutine 0.
Q0.1
When pulse width change to
50% duty cycle is required,
M0.0 is set.
Network 2
End of main ladder.
Preload control byte for
subsequent pulse width
changes.
.
.
P
.
.
1
LAD STL
M0.0
IN OUT
EN
16#DA
MOV_B
SMB77
SBR0
SBR1
ENO
ENO
ENO
ENO
ENO
MAIN OB1
SUBROUTINE 0
Network 1
LD SM0.0
MOVW 5000, SMW80
PLS 1
SUBROUTINE 1
5000
SMW80
SM0.0
PLS
EN
Q0.X1
Assert pulse width change.
Set pulse width to 5000 ms
Start of subroutine 1
IN
MOV_W
OUT
EN ENO
ENO
Figure 9-21 Example of High-Speed Output Using Pulse Width Modulation