COUNT – Controlled counter

Block SymbolLicensing group: STANDARD
PIC

Function Description
The COUNT block is designed for bidirectional pulse counting – more precisely, counting rising edges of the UP and DN input signals. When a rising edge occurs at the UP (DN) input, the cnt output is incremented (decremented) by 1. Simultaneous occurrence of rising edges at both inputs is indicated by the error output E set to on. The R1 input resets the counter to 0 and no addition or subtraction is performed unless the R1 input returns to off again. It is also possible to set the output cnt to the value n0 by the SETH input. Again, no addition or subtraction is performed unless the SETH input returns to off again. The R1 input has higher priority than the SETH input. The input HLD = on prevents both incrementing and decrementing. When the counter reaches the value cnt nmax, the Q output is set to on.

Inputs

R1

Block reset (R1 = on)

Bool

n0

Value to set the counter to (using the SETH input)

Long (I32)

SETH

Set the counter value to n0 (SETH = on)

Bool

UP

Incrementing input signal

Bool

DN

Decrementing input signal

Bool

HLD

Counter freeze

Bool

off ..

Counter is running

on ...

Counter is locked

nmax

Counter target value

Long (I32)

Outputs

cnt

Total number of pulses

Long (I32)

SGN

Sign of the cnt output

Bool

off ..

for cnt < 0

on ...

for cnt 0

Q

Target value indicator

Bool

off ..

for cnt < nmax

on ...

for cnt nmax

E

Indicator of simultaneous occurrence of rising edges at both inputs UP and DN

Bool

2021 © REX Controls s.r.o., www.rexygen.com