With some applications it is important to set a counter back to its initial value as quickly as possible when it reaches specific comparison value.
Furthermore, normally at the moment of resetting a series of calculations are made to determine the next comparison value (to optimize the point of intersection of the material).
You have the option of doing a reset also without the standard function FC CNT_CTRL.
Proceed as follows to configure the counter for fast reset:
- In the "Properties" dialog box of the counter module, in the "Basic parameters" area, set the option Generate interrupt to "YES" and the option Interrupt selection to "Process". In this way you generate an interrupt at the moment of resetting.
- In the "Outputs" parameter mask configure the digital output DQ0 so that this is activated when the comparison value is reached.
- In the "Inputs" parameter mask, in the field "Set counter", set the option "multiple".
In the associated channel DB the bit DBX 27.0 or DBX 27.1 (CTRL_DQ0) must be set to 1 to enable setting in the correct direction.
- In "Interrupt release" parameter mask select the option "Set counter" so that the interrupt is triggered by a rising edge at the digital input SET.
- The digital input I2 of the block FM 350-1 / FM 450-1 is used to reset the counter to the initial value. This input is connected to the digital output Q0 (likewise to the FM 350-1 / FM 450-1).
In the associated channel DB the data double word DBD 14 (LOAD_VAL) must be set to the initial value beforehand (e.g. L#0). The data double word DBD18 (CMP_V1) must be set to the comparison value.
These values must be transferred with the FC CNT_CTRL to the FM by setting the relevant triggering bit once on the FC.