Name :Multi-segment pulse output
Symbol:PTO
Illustrate:
With this function block, you can control the pulse output, which makes the pulse of the duty cycle 50%, and can control the multi-segment pulse output to achieve the effect of outputting a specified number of pulses at a certain speed and acceleration
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 cannot be triggered again if it is not completed) | Yes/FALSE |
| PULSESECNUM | UINT | IN | The number of pulse output segments | EXECUTE rising edge | not |
| PULSESECINFO | T_PULSE_SEC_INFO * | IN | Pulse segment structure array first address: describes the information of each pulse segment | EXECUTE the rising edge | not |
| 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: Units ms | Stop the pulse output within the set time. NON-0;0: RUNS BY DEFAULT (LOADED ON EXECUTE RISING EDGE) | Yes/5 |
| DONE | BOOL | OUT | All pulse segments are output to the mark of completion | TRUE:Pulse segment output completed (status retention for 1 cycle) | Yes/FALSE |
| BUSY | BOOL | OUT | Pulse output status | TRUE:The pulse is being 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 |
THE STRUCTURE OF PULSESECINFO IS AS FOLLOWS:
|
The name of the data |
Data type |
Content Description: |
|---|---|---|
|
STARTFREQ |
UDINT |
Current pulse segment: the starting pulse frequency, in units Hz(0-200KHz) |
|
ENDFREQ |
UDINT |
Current Pulse Band: End pulse frequency, in units Hz(0-200KHz) |
|
PULSENUM |
DINT |
Current Pulse Segment: Number of Pulses + Direction (Positive - Forward Motion; Negative - Backward Motion) |
Error codes:
| Error codes | Illustrate |
|---|---|
| 0 | Inerrancy |
| 1 | Invalid pulse port |
| 2 | The pulse port is busy/pre> |
| 3 | The pulse port is performing a stop action |
| 4 | The number of pulse segments is 0 |
| 5 | The pulse segment buffer is empty |
| 6 | The number of pulses is 0 |
| 7 | The frequency exceeds the maximum allowable range |
| 8 | The pulse frequency of the two segments is not continuous |
| 9 | The two segments have different pulse directions |
Example:
LD:
ST:
Interpretation:
IF OUTPORT IS 0, THE 0TH PULSE IS USED; EXECUTE is the rising edge, which means that the operation is valid and the function block is started; PULSESECNUM IS 1, WHICH MEANS THAT THE FUNCTION BLOCK ONLY EXECUTES THE OUTPUT OF ONE PULSE SEGMENT. The description of the multi-pulse segments is stored in PulseSecInfoRef: the start frequency, end frequency, number of pulses + direction of each segment; If ABORT is FALSE, the emergency stop is not being performed at this time. A STOPTIME of 100 indicates that the pulse frequency needs to be slowed down to 0 within 100 ms when an emergency stop is performed. If DoneOut is TRUE, the output of the multi-segment pulse has been completed. If BusyOut is TRUE, it means that the function block is outputting multiple pulses; If CmdStopOut is TRUE, it means that the function block is making an emergency stop and has not yet slowed down to zero. If ErrorOut is set to TRUE, the function block is faulty and the error code is ErrorIDOut.