PWM Function (MICRO - PREMIUM ) on PL7 software

PWM Function


The PWM function supports regulation of a pulse width on a TOR output.
It is a function that formats the PID’s output.
The pulse width depends on the PID’s output (The PWM function’s INP input)
and the modulation period.
 The PID operation have been described in a previous post
The circuit diagram of the function’s operation is as follows:


To each TOP of the T_MOD modulation period, the activation period
in 10-3 second of the PW_O output is calculated according to the following formula:
State 1 of the gap (shown in 10-2 seconds) = INP * T_MOD / 1000

The following timing diagram illustrates this formula:


Practical rules
T_MOD = TS (where TS is the sampling period of the upstream PID),
The period of the current task (expressed in 10-3 second) is equal to:
(Required resolution)* 10 * T_MOD.
The PID is in the MAST task, the MAST’s period is 50*10-3 s,
TS = 500*10-2 s and the required resolution is 1/50
(a T_MOD period must contain at least 50 periods of the current task).

T_MOD = TS = 500.

The period of the task where the PWM is introduced must therefore be less
than 500 * 10 /50 =100 10-3 s.

The PWM function can therefore be programmed in the MAST task.
the resolution will be 1/100.

The PWM function is a standard PL7 function. As such, it is available from the
functions library.
From the language editors there, it is possible to use the help of a PWM
function’s input to facilitate its programming.

From the PL7 menu Tools --> Library the next picture appears

The illustration gives you a general idea of the Functions screen in the library
supporting the implementation of the PWM function.


The PWM function’s call syntax is:
PWM(INP,PW_0,PARA)  Equation 1

For the Purpose of the example a Micro CPU TSX3722 used
with a TSXDSZ08T2 card  (8 Transistor Outs) in order to have
the digital output for the PWM output.
The selection of a Transistor Output was done because of the long life time of the transistor.
Of course the developer has to use additional relays for the output
The following picture illustrate the configuration of the PLC



The PID operate function which explained in a previous post is


Next the Allingment of the T_MOD (PWM) on the TS of the PID 
 which is the %MW105




 And Finally in the Mast Or Fast task the PWM Operate Function in which the PWM output is the %Q3.0


Using the equation 1
PWM(INP,PW_0,PARA)
INP = %MW52
PW_0 = :%Q3.0
PARA = %MW90:5
The following Illustration all the parameters explained 



 NOTE FOR THE READER : THE ABOVE IS THE CONFIGURATION ONLY AND TYPICAL EXAMPLES ON HOW TO CONGIGURE THE PWM FUNCTION IN PL7 SOFTWARE. THE INFORMATION GIVEN ARE NOT A COMPLETE APPLICATION AND THE DEVELOPER MUST MAKE HIS OWN CALCULATIONS TO ACHIEVE PWM CONTROL IN HIS SPECIFIC APPLICATION. IT'S THE RESPONSIBILITY OF THE USER TO USE THE INFORMATION ABOVE CORRECTLY IN THE APPLICATION. IMPROPER USE MAY RESULT IN EQUIPMENT DAMAGE OR HUMAN INJURIES