Publication 1766-RM001A-EN-P - October 2008
Using High-Speed Outputs
159
PWM Function
The PWM function allows a field device to be controlled by a PWM wave
form. The PWM profile has two primary components:
•
Frequency to be generated
•
Duty Cycle interval
The PWM instruction, along with the HSC and PTO functions, are
different than all other controller instructions. Their operation is
performed by custom circuitry that runs in parallel with the main system
processor. This is necessary because of the high performance
requirements of these instructions.
The interface to the PWM sub-system is accomplished by scanning a PWM
instruction in the main program file (file number 2), or by scanning a
PWM instruction in any of the subroutine files. A typical operating
sequence of a PWM instruction is as follows:
1.
The rung that a PWM instruction is on is solved true (the PWM is
started).
2.
A waveform at the specified frequency is produced.
3.
The RUN phase is active. A waveform at the specified frequency
with the specified duty cycle is output.
4.
The rung that the PWM is on is solved false.
5.
The PWM instruction is IDLE.
While the PWM instruction is being executed, status bits and data are
updated as the main controller continues to operate. Because the PWM
instruction is actually being executed by a parallel system, the status bits
and other information are updated each time the PWM instruction is
scanned while it is running. This provides the control program access to
PWM status while it is running.
Pulse Width Modulation
(PWMX) Function File
Within the PWMX function file are three PWMX elements. Each element
can be set to control either output 2 (O0:0/2), output 3 (O0:0/3), or
output 4 (O0:0/4). Function file element PWMX:0 is shown below.
TIP
PWM status is only as fresh as the scan time of the controller. Worst case
latency is the maximum scan of the controller. This condition can be
minimized by placing a PWM instruction in the STI (selectable timed
interrupt) file, or by adding PWM instructions to your program to increase
how often a PWM instruction is scanned.
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive