LOGO! functions 4.4.29 Pulse Width Modulator (PWM) Short description The Pulse Width Modulator (PWM) instruction modulates the analog input value Ax to a pulsed digital output signal. The pulse width is proportional to the analog value Ax. Symbol in LOGO! Wiring Description Input Ax Analog signal to be modulated to a pulsed digital output signal. Parameter A: B: T: p: Output Q Gain Range of values: +-- 10.00 Zero offset Range of values: +-- 10,000 Periodic time over which the digital output is modulated Number of decimals Range of values: 0, 1, 2, 3 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. Parameter T Note the defaults of the T parameters listed in Chapter 4.3.2. The periodic time T can be provided by the actual value of another already--programmed function. You can use the actual value of the following functions: • Analog comparator (actual value Ax - Ay, see Chapter 4.4.18) • Analog threshold trigger (actual value Ax, see Chapter 4.4.16) • Analog amplifier (actual value Ax, see Chapter 4.4.20) • Analog multiplexer (actual value AQ, see Chapter 4.4.26) • Analog ramp (actual value AQ, see Chapter 4.4.27) • Analog math (actual value AQ, see Chapter 4.4.30) • PI controller (actual value AQ, see Chapter 4.4.28) • Up/down counter (actual value Cnt, see Chapter 4.4.13). Select the required function by the block number. The timebase is configurable. For information on valid ranges and parameter defaults, refer to Chapter 4.4.1. Parameters p (number of decimals) Parameter p applies only to the display of the Ax value in a message text 206 LOGO! Manual A5E01248535--01 LOGO! functions Functional description 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 actual value Ax to the range. The block sets the digital output Q high for the same proportion of the T (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 digital output signal from the analog input value: 1. An analog value of 500 (range 0...1000) as the value for Ax must be modulated to a digital signal string. The user--defined T (periodic time) parameter is 4 seconds. At the digital output of the PWM function the digital signal string is 2 seconds high, 2 seconds low, 2 seconds high, 2 seconds low and continues in that pattern as long as parameter En = high. 2. An analog value of 300 (range 0...1000) as the value for Ax must be modulated to a digital signal string. The user--defined T (periodic time) parameter is 10 seconds. At the digital output of the PWM function the digital signal string is 3 seconds high, 7 seconds low, 3 seconds high, 7 seconds low and continues in that pattern as long as parameter ”En” = high. LOGO! Manual A5E01248535--01 207 LOGO! functions Calculation rule Q = 1, for (Ax -- Min)/ (Max -- Min) of time period T, when Min < Ax < Max Q = 0, for PT -- [ (Ax -- Min) / (Max -- Min) ] of time period T. Note: Ax in this calculation refers to the actual value Ax as calculated using the Gain and Offset. Setting the Par Parameter The following illustration shows the view in programming mode that corresponds to the first example: B1 1+/ Min=+00000 Max=+01000 A=+01.00 Press A " B1 2+/ B=+00000 T=00:04s P=2 Use the and keys to navigate to the Min, Max, A, B, T and P parameters. For each digit of a value, use the and keys to scroll through value choices. Use the key to navigate to the second screen from the last line of the first screen, and the key to navigate from the top line of the second screen to the first screen. Use the OK key to accept changes. View in parameter assignment mode: B1 1 Min=+00000 Max=+01000 A = 1.00 208 Press A " B1 2 B =+00000 T =00:04s LOGO! Manual A5E01248535--01