Short description
The Pulse Width Modulator (PWM) instruction modulates the analog input value Ax to a pulsed output signal. The pulse width is proportional to the analog value Ax.
Connection |
Description |
Input Ax |
Analog signal to be modulated to a pulsed output signal. |
Parameter |
Min: Max: A: Gain B: Zero offset PT: Periodic time over which the output is modulated p: Number of decimals |
Output Q |
Q is set or reset for the proporition of each time period according to the proportion of the standardized value Ax to the analog value range. |
|
FL1A-FL1D: The PWM function block did not exist prior to FL1E.
|
Parameter PT
The periodic time PT can be provided by the actual value of another already-programmed function:
Analog comparator: Ax - Ay
Analog trigger: Ax
Analog amplifier: Ax
Analog multiplexer: AQ
Analog ramp: AQ
Analog math: AQ
PI controller: AQ
Up/down counter: Cnt
Parameter p (number of decimals)
Parameter p applies only to the display of the Ax value in a message text.
Description of the function
The function reads the value of the signal at the analog input Ax.
This value is multiplied by the value of parameter A (gain). Parameter B (offset) is added to the product, as follows:
(Ax * Gain) + Offset = Actual value Ax
The function block calculates the proportion of the value Ax to the range. The block sets the output Q high for the same proportion of the PT (periodic time) parameter, and sets Q low for the remainder of the time period.
Examples with Timing Diagrams
The following examples show how the PWM instruction modulates a output signal from the analog input value:
Example 1
Analog input value: 500 (range 0...1000)
Periodic time T: 4 seconds
The output of the PWM function is 2 seconds high, 2 seconds low, 2 seconds high, 2 seconds low and continues in that pattern as long as parameter "En" = high.
Example 2
Analog input value: 300 (range 0...1000)
Periodic time T: 10 seconds
The output of the PWM function is 3 seconds high, 7 seconds low, 3 seconds high, 7 seconds low and continues in that pattern as long as parameter "En" = high.
Calculation rule
Q = 1, for (Ax - Min) / (Max - Min) of time period PT
Q = 0, for PT - [(Ax - Min) / (Max - Min)] of time period PT.
Note: Ax in this calculation refers to the actual value Ax as calculated using the Gain and Offset. Min and Max refer to the minimum and maximum values specifed for the range.
Particular characteristics to be noted when configuring
Refer to the help on analog block parameters in the Analog value processing section.