User Manual

Programming made easy
6.3 Powerful instructions make programming easy
Easy Book
Manual, 03/2014, A5E02486774-AF
111
Table 6- 19 CTUD (count up and down) counter
LAD / FBD
SCL
Operation
"ctud_db".CTUD(
CU:=_bool_in,
CD:=_bool_in,
R:=_bool_in,
LOAD:=_bool_in,
PV:=_undef_in,
QU=>_bool_out,
QD=>_bool_out,
CV=>_undef_out);
The timing diagram shows the operation of a CTUD counter with an unsigned integer count
value (where PV = 4).
If the value of parameter CV (current count value) is equal to or greater than the value of
parameter PV (preset value), then the counter output parameter QU = 1.
If the value of parameter CV is less than or equal to zero, then the counter output
parameter QD = 1.
If the value of parameter LOAD changes from 0 to 1, then the value at parameter PV is
loaded to the counter as the new CV.
If the value of the reset parameter R changes from 0 to 1, CV is reset to 0.
6.3.7
Pulse-width modulation (PWM)
Table 6- 20 CTRL_PWM instruction
LAD / FBD
SCL
Desciption
"ctrl_pwm_db"(
PWM:=_hw_pwm_in_,
enable:=_bool_in_,
busy=>_bool_out_,
status=>_word_out_);
The CTRL_PWM instruction provides a fixed cycle
time output with a variable duty cycle. The PWM
output runs continuously after being started at the
specified frequency (cycle time). The pulse width is
varied as required to affect the desired control.
The CTRL_PWM instruction stores the parameter information in the DB. For SCL, you must
first create the DB for the instruction before you can reference it. For LAD and FBD, STEP 7
automatically creates the DB when you insert the instruction. The data block parameters are
controlled by the CTRL_PWM instruction.
The pulse width will be set to the initial value configured in device configuration when the
CPU first enters the RUN mode. You write values to the word-length output (Q) address that
was specified in device configuration ("Output addresses" / "Start address") as needed to
change the pulse width. Use an instruction (such as Move, Convert, Math, or PID) to write
the specified pulse width to the appropriate word-length output (Q). You must use the valid
range for the output value (percent, thousandths, ten-thousandths, or S7 analog format).