Using the pulse generators of the S7-1200
7.2 Pulse-width modulation (PWM)
Easy Book
Manual, 05/2009, A5E02486774-01
87
Configuring the pulse generators
The two pulse generators are mapped to specific digital outputs as shown in the following
table. You can use onboard CPU outputs, or you can use the optional signal board outputs.
The output point numbers are shown in the following table (assuming the default output
configuration). If you have changed the output point numbering, then the output point
numbers will be those you assigned. Regardless, PTO1/PWM1 uses the first two digital
outputs, and PTO2/PWM2 uses the next two digital outputs, either on the CPU or on the
attached signal board. Note that PWM requires only one output, while PTO can optionally
use two outputs per channel. If an output is not required for a pulse function, it is available
for other uses.
Description
Default output assignment
Pulse
Direction
Onboard CPU
Q0.0
Q0.1
PTO 1
Signal board
Q4.0
Q4.1
Onboard CPU
Q0.0
--
PWM 1
Signal board
Q4.0
--
Onboard CPU
Q0.2
Q0.3
PTO 2
Signal board
Q4.2
Q4.3
Onboard CPU
Q0.2
--
PWM 2
Signal board
Q4.2
--
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.