EasyManua.ls Logo

Siemens SIMATIC S7 - Pwmx_Run Subroutine

Siemens SIMATIC S7
866 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Open loop motion control
12.1 Using the PWM output
S7-200 SMART
598 System Manual, V2.3, 07/2017, A5E03822230-AF
12.1.2
PWMx_RUN subroutine
To simplify the use of Pulse Width Modulation (PWM) control in your application,
STEP 7-Micro/WIN SMART provides a PWM wizard (Page 596) to configure your on-board
PWM generators and control the duty cycle of a PWM output.
The PWMx_RUN subroutine is used to execute PWM under program control.
LAD / FBD
STL
Description
CALL PWMx_RUN, Cycle, Pulse, Error
The PWMx_RUN subroutine allows you to
control the duty cycle of the output by vary-
ing the pulse width from 0 to the pulse
width of the cycle time.
Table 12- 1 Parameters for the PWMx_RUN subroutine
Inputs/Outputs
Data types
Operands
Cycle, Pulse Word IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AIW, *VD, *AC, *LD, Constant
Error
Byte
IB, QB, VB, MBV, SMB, LB, AC, *VD, *AC, *LD, Constant
The Cycle input is a word value that defines the cycle time for the pulse width modulation
(PWM) output. The allowed range is from 2 to 65535 when milliseconds is the time base and
10 to 65535 when microseconds is the time base.
The Pulse input is a word value that defines the pulse width (Duty Cycle) for the PWM
output. The allowed range of values is from 0 to 65535 units of the time base (microseconds
or milliseconds) that was specified within the PWM wizard.
The Error is a byte value returned by the PWMx_RUN subroutine that indicates the result of
execution. See the following table for a description of the possible error codes.
Table 12- 2 PWMx_RUN instruction error codes
Error code
Description
0 No error, normal completion
131
Pulse generator already in use by another PWM or by a motion axis, or illegal time base change

Table of Contents

Other manuals for Siemens SIMATIC S7

Related product manuals