Omron CP1E-E@@D@-@ Computer Hardware User Manual


 
2 Instructions
2-340
CP1E CPU Unit Instructions Reference Manual(W483)
Operand Specifications
Flags
Function
PWM(891) outputs the frequency specified in F at the duty factor specified in D from the port specified
in P. PWM(891) can be executed during duty-factor PWM output to change the duty factor without stop-
ping PWM output. Any attempts to change the frequency will be ignored.
PWM output is started each time PWM(891) is executed. It is thus normally sufficient to use the differ-
entiated version (@PWM(891)) of the instruction or an execution condition that is turned ON only for
one scan.
The PWM output will continue either until INI(880) is executed to stop it (C = 0003 hex: stop PWM out-
put) or until the CPU Unit is switched to PROGRAM mode.
Note PWM instruction can be used only with transistor output type of CP1E N/NA-type CPU Unit.
In case of transistor output type of CP1E E-type CPU Unit or relay output type, NOP processing is applied.
Sample program
When CIO 0.00 turns ON in the following programming example, PWM(891) starts PWM output from
PWM output 0 at 200 Hz with a duty factor of 50%. When CIO 0.01 turns ON, the duty factor is changed
to 25%.
Area
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits
CIO WR HR AR T C DM @DM *DM
P --- --- --- --- --- --- --- --- ---
OK --- --- ---
F, D OKOKOKOKOKOKOK OK OK
Name Label Operation
Error Flag P_ER ON if the specified range for P, F, or D is exceeded.
ON if PWM are being output using ORG(889) for the specified port.
ON if PWM(891) is executed in an interrupt task when an instruction controlling PWM output is being executed in a
cyclic task.
OFF in all other cases.
@PWM
#1000
#07D0
&500
0.00
@PWM
#1000
#07D0
&250
0.01
CIO 0.00 ON CIO 0.01 ON
PWM output 0
Frequency: 200.0 Hz
Duty factor: 50%
PWM output 0
Frequency: 200.0 Hz
Duty factor: 25%
Duty factor: 50% Duty factor: 25%