The input pins are Input, Enable and Preset. Additionally, the conditions, StopAtZero, PresetVaue and CountValue are also provided. The output pin is Count. This function counts leading edge transitions of the input. If enable is True and the input transitions from False to True, then the count is incremented or decremented by the count value. Positive values on count value increment the count. Negative values decrement the count. If preset is True, the count is set to the Preset Value. From iteration to iteration, the Function Block keeps track of the previous state of the input so that it can detect a transition. On power up or reset, this is cleared.
Logic Inputs
| Input Name | Input Value | Logic Value | Description |
| Input | unconnected | 0 | Set Input = False |
| invalid | 0 | Set Input = False | |
| 0 | 0 | Input is False | |
| VAL != 0.0 | 1 | Input is True | |
| Enable | unconnected | 1 | Set Enable = True |
| invalid | 1 | Set Enable = True | |
| 0 | 0 | Set Enable = False | |
| VAL != 0.0 | 1 | Set Enable = True | |
| Preset | unconnected | 0 | Set Preset = False |
| invalid | 0 | Set Preset = False | |
| 0 | 0 | Set Preset = False | |
| VAL != 0.0 | 1 | Set Preset = True | |
| StopAt Zero | unconnected | 0 | Set Stop At Zero = False. Default value is False. |
| invalid | 0 | Set Stop At Zero = False. | |
| 0 | 0 | Stop At Zero is False. Count is unaffected by a zero value. | |
| VAL != 0.0 | 1 | Stop At Zero is True. Stops counting at zero if counting down from a positive count or up from a negative count. |
Analog Inputs
| Range | ||||
| Input Name | Low | High | Input Value | Description |
| CountValue | >=- infinity | <+ infinity | unconnected | Set Count Value = 1.0 Default value = 1.0 |
| Invalid | Set Count Value = 1.0 | |||
| VAL < low | Set Count Value = 1.0 | |||
| VAL > high | Set Count Value = 1.0 | |||
| PresetValue | >=- infinity | <+ infinity | unconnected | Set Preset Value = 0.0 |
| Invalid | Set Preset Value = 0.0 | |||
| VAL < low | Set Preset Value = 0.0 | |||
| VAL > high | Set Preset Value = 0.0 | |||
Output
| Output Name | Range | Description |
| COUNT | Any floating point number | Counter value |
Transition versus time with positive and negative count values
