Name :Constant frequency pulse output

Symbol:PTO_FREQ

Illustrate:

        With this function block, you can control the pulse frequency from the current frequency, add or subtract to the specified frequency with trapezoidal acceleration and deceleration, and maintain the pulse output of the specified frequency for a long time. The pulse output by this function block is a pulse with a temporary-to-space ratio of 50%.

Image:

Parameter:

Parameter | Statement | IN/OUT | Parameter role | Illustrate | Default value
--- | --- | --- | --- | --- | ---
OUTPORT | UDINT | IN | Pulse output port | 0-7 |
    not
EXECUTE | BOOL | IN | The function block is enabled | Rising edge trigger (after triggering, it can be triggered again after modifying the input parameters) |
    not
FREQ | DINT | IN | Target frequency + direction | 1-200KHz；Positive -- Forward, Negative -- Backward, 0 - Default Run (EXECUTE Rising Edge Load) |
    Yes/100
ACC | UDINT | IN | Acceleration/deceleration: Units Hz/ms | Non-0 (0: Use default value) not to exceed maximum acceleration (1000Hz/ms) (loaded on EXECUTE rising edge) |
    Yes/100
ABORT | BOOL | IN | Emergency stop triggering | TRUE：Emergency stop enabled (irrevocable after enabled, and cannot be re-enabled until the processing is completed) |
    Yes/FALSE
STOPTIME | UDINT | IN | Emergency stop time: Unitsms | Stop the pulse output within the set time. NON-0;0: RUNS BY DEFAULT (LOADED ON EXECUTE RISING EDGE) |
    Yes/5
DONE | BOOL | OUT | The target frequency reaches the mark | TRUE：Target frequency reached (constant frequency output process, always maintained) |
    Yes/FALSE
BUSY | BOOL | OUT | Pulse output status | TRUE：The pulse is in normal output |
    Yes/FALSE
CMDSTOP | BOOL | OUT | Emergency stop status | TRUE：During the emergency stop, the pulse frequency has not been reduced to 0 (at this time, it is not possible to respond to the new axis start control)） |
    Yes/FALSE
ERROR | BOOL | OUT | Error flags | TRUE：There was an error with the function block call |
    Yes/FALSE
ERRORID | DINT | OUT | Error codes | 0：Normal, Other: Error code value |
    Yes/0

Error codes:

Error codes | Illustrate
--- | ---
0 |
    Inerrancy
1 |
    Invalid pulse port
2 |
    The pulse port is busy
3 |
    The pulse port is performing a stop action
7 |
    The frequency exceeds the maximum allowable range
10 |
    Acceleration exceeds the maximum allowable value

Example:

LD:

ST:

PTO_FREQ_inst1(OUTPORT := 0, EXECUTE := TRUE, FREQ := 10000, ACC := 100, ABORT := FALSE, STOPTIME := 100, DONE => DoneOut, BUSY => BusyOut, CMDSTOP => CmdStopOut, ERROR => ErrorOut, ERRORID => ErrorIDOut);

Interpretation:

       OUTPORT: 0 indicates the operation of the 0th pulse;
       EXECUTE: The rising edge indicates that this function block is executed;
       FREQ: 10000 means that the target frequency is 10000Hz, and the 0th pulse will eventually output a pulse of 10000Hz and make the motor move forward (iFreq is a positive number);
       ACC: 100 means that the frequency of the pulse will change with an acceleration of 100Hz/ms, so that the frequency finally reaches the target frequency of 10000Hz;
       ABORT: If the emergency stop is not performed, it is not currently being stopped.
       STOPTIME: 100 means that when the emergency stop is executed, the pulse output frequency will be reduced to 0 within 100ms (if the set deceleration time cannot meet the maximum deceleration, the time will be automatically increased);
       If DoneOut is TRUE, the output frequency of the 0th pulse has reached the target frequency.
       If BusyOut is TRUE, it means that the 0th pulse output is in progress;
       If CmdStopOut is TRUE, the current function block is performing an emergency stop and the pulse frequency has not been reduced to 0.
       ErrorOut indicates that the function block is faulty, and the error code is ErrorIDOut.