BD30_COUNTER
PROGRAM BD30_COUNTER_DEMO VAR L1: LINT; FB1: LIB.CORE.V1_0.BD30_COUNTER; FB2: LIB.CORE.V1_0.BD2_PULSE_GENERATOR; END_VAR FB2(); FB1(BX := FB2.OUT); L1 := FB1.OUT; END_PROGRAM
LIB\CORE
V1.0
The block is a pulse counter. Number of pulses is brought to the output OUT. The OUT value may be increased by 1 at rising edge on the BX input, or at falling edge of the BXF input. It may be also decreased by 1 at rising edge on the BXD input, or at falling edge of the BXDF input. The MINIMUM parameter specifies the lower limit of the counting range of OUT, while MAXIMUM is the upper limit. All possible values are thus MINIMUM,MINIMUM+1,MINIMUM+2,…,MAXIMUM-1,MAXIMUM. The behaviour at MINIMUM and MAXIMUM is given by the parameter BRING:
The counter may be reset by a rising edge at the BR input. If BR=TRUE then OUT=MINIMUM and counting is stopped.
Input | Type | Description | Default value |
BX | BOOL | Rising edge increases the OUT value by 1 | False |
BXF | BOOL | Falling edge increases the OUT value by 1 | False |
BXD | BOOL | Rising edge decreases the OUT value by 1 | False |
BXDF | BOOL | Falling edge decreases the OUT value by 1 | False |
BR | BOOL | Reset – if BR=TRUE then OUT=MINIMUM | False |
MINIMUM | LINT | Minimum value of OUT | 0 |
MAXIMUM | LINT | Maximum value of OUT | 10000 |
BRING | BOOL | Overflow switch. If BRING=TRUE then the counter is a cyclic counter, if BRING=FALSE then the counter stops at MINIMUM or MAXIMUM values. | False |
Output | Type | Description |
OUT | LINT | Counter value (OUT may be equal to MINIMUM,MINIMUM+1,MINIMUM+2,…,MAXIMUM-1,MAXIMUM) |