Académique Documents
Professionnel Documents
Culture Documents
Behavior:
While the PWM is not enabled by the CTRL_PWM, the digital output works like a normal digital output.
Once the PWM is enabled, the output is dived by the PWM. Note however that the monitoring of the
digital output, follow the digital logic.
Sample program:
The follow sample program is very simple. There is just the device configuration settings and a
CTRL_PWM call. In the watch table, you can modify the digital output, and enable / disable the PWM to
see how they works.
Attachment:
Description
You can change the pulse length for the pulse width modulation (PWM) in the user program. Proceed as follows.
No. Procedure
1
In STEP 7 Basic V11 you open the device configuration of the S7-1200 CPU in your project.
In the "Properties" tab you select "Pulse generators (PTO/PWM) > PTO1/PWM1 > General".
Enable the "Enable this pulse generator" option.
Fig. 01
4
In the "Properties" tab you select "Pulse generators (PTO/PWM) > PTO1/PWM1 > I/O addresses".
Here you define the output addresses. In this example, the output word AW1000 is defined and
assigned as output address.
Fig. 02
5
In this example the enable pulse generator has the following ID:
The hardware ID of the pulse generator is created as a system constant in the PLC variable table of
the S7-1200 CPU.
Fig. 03
6
In the user program, insert the MOVE instruction at the point where the pulse length is to be
changed. In this example the MOVE instruction is inserted in Network 1 of the Main(OB1) program
block. The MOVE instruction is to be found in the task card "Instructions" > "Basic instructions >
Move operations" palette.
Specify the new pulse length at the IN input (value range: 0 to 100).
At the OUT1 output you specify the output word AW1000. The output word AW1000 is the assigned
output word of the pulse generator.
Fig. 04
7
Insert the CTRL_PWM instruction after the MOVE instruction. In this example the CTRL_PWM
instruction is inserted in Network 2 of the Main(OB1) program block. The CTRL_PWM instruction is
to be found in the task card "Instructions" > "Advanced instructions > Move operations" palette.
You specify the hardware identifier of the pulse generator at the PWM input. For the hardware ID of
the pulse generator you select the corresponding system constant from the drop-down list box.
Fig. 05
The pulse generator is enable and disabled through the ENABLE input.