101BExtended instructions
8.6 Pulse
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
287
8.6
Pulse
8.6.1
CTRL_PWM instruction
Table 8- 117 CTRL_PWM (Pulse Width Modulation) instruction
LAD / FBD
SCL
Description
"CTRL_PWM_DB"(
PWM:=_word_in_,
enable:=_bool_in_,
busy=>_bool_out_,
status=>_word_out_);
Provides a fixed cycle time output with a variable duty
cycle. The PWM output runs continuously after being
started at the specified frequency (cycle time). The
pulse width is varied as required to affect the desired
control.
1
STEP 7 automatically creates the DB when you insert the instruction.
2
In the SCL example, "CTRL_PWM_DB" is the name of the instance DB.
CTRL_HSC
Table 8- 118 Data types for the parameters
Parameter and type
Data type
Description
PWM
IN
HW_PWM
(Word)
PWM identifier: Names of enabled pulse generators will become tags in
the "constant" tag table, and will be available for use as the PWM
parameter. (Default value: 0)
ENABLE
IN
Bool
1=start pulse generator
0 = stop pulse generator
BUSY
OUT
Bool
Function busy (Default value: 0)
STATUS
OUT
Word
Execution condition code (Default value: 0)
The CTRL_PWM instruction stores the parameter information in the DB. The data block
parameters are not separately changed by the user, but are controlled by the CTRL_PWM
instruction.
Specify the enabled pulse generator to use, by using its tag name for the PWM parameter.
When the EN input is TRUE, the PWM_CTRL instruction starts or stops the identified PWM
based on the value at the ENABLE input. Pulse width is specified by the value in the
associated Q word output address.
Because the CPU processes the request when the CTRL_PWM instruction is executed,
parameter BUSY will always report FALSE. If an error is detected, then ENO is set to
FALSE, and parameter STATUS contains a condition code.