Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Easy Book
84 Manual, 11/2009, A5E02486774-01
Easy to use the built-in pulse generators
7.2 Pulse-width modulation (PWM)
To prepare for PWM operation, first configure a pulse channel in the device configuration by
selecting the CPU, then "Pulse Generator (PTO/PWM)", and choose either "PWM1" or
"PWM2". Enable the pulse generator (check box). If a pulse generator is enabled, a unique
default name is assigned to this particular pulse generator. You can change this name by
editing it in the "Name:" edit box, but it must be a unique name. Names of enabled pulse
generators will become tags in the "constant" tag table, and will be available for use as the
PWM parameter of the CTRL_PWM instruction. You have the option to rename the pulse
generator, add a comment, and assign parameters as follows:
● Pulse generator used as follows: PWM or PTO (choose PWM)
● Output source: onboard CPU or Signal Board
● Time base: milliseconds or microseconds
● Pulse width format:
– Percent (0 to 100)
– Thousandths (0 to 1000)
– Ten-thousandths (0 to 10000)
● Cycle time: Enter your cycle time value. This value can only be changed here.
● Initial pulse width: Enter your initial pulse width value. The pulse width value can be
changed during runtime.
● Start address: Enter the word-length address of the output (Q) where you want to locate
the pulse width value. The default location is QW1000 for PWM1, and QW1002 for
PWM2. The value at this location controls the width of the pulse and is initialized to the
"Initial pulse width:" value specified above each time the PLC transitions from STOP to
RUN mode. You change this Q-word value during run time to cause a change in the
pulse width.
Easy Book
Manual, 11/2009, A5E02486774-01 85
Easy to use the built-in pulse generators
7.2 Pulse-width modulation (PWM)
Use the tag name for the PWM parameter to specify the enabled pulse generator.
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 on S7-1200
CPU models.
The pulse width will be set to the initial value configured in device configuration when the
PLC first enters the RUN mode. You write values to the word-length output (Q) address that
was specified in device configuration ("Output addresses" / "Start address:") as needed to
change the pulse width. Use an instruction, such as Move, Convert, Math, or PID, to write
the specified pulse width to the appropriate word-length output (Q). You must use the valid
range for the output value (percent, thousandths, ten-thousandths, or S7 analog format).
Easy Book
86 Manual, 11/2009, A5E02486774-01