The ‘count’ record increments each time it’s processed unless the ‘clear’ record has pushed a 1 into the ‘C’ field.
record(bi, "$(user):now") {
field(PINI, "YES")
field(SCAN, "10 second")
field(FLNK, "$(user):day")
}
record(stringin, "$(user):day") {
field(DTYP, "Soft Timestamp")
field(INP, "@%j")
field(TSEL, "$(user):now.TIME")
field(FLNK, "$(user):clear")
}
record(calcout, "$(user):clear") {
field(INPA, "$(user):day NPP MS")
field(INPB, "1000")
field(CALC, "A<B;B:=A")
field(OOPT, "When Non-zero")
field(OCAL, "1")
field(OUT, "$(user):count.C PP")
}
record(calc, "$(user):count") {
field(VAL, "0")
field(TPRO, 1)
field(CALC, "C?0:VAL+1;C:=0")
}
Hi all,
I'd like to create a database record that counts based on a forward link. This record would need to reset back to zero
at 12AM every day.
Use case, is where a beam line user hits a reset button repeatably (tied to a bo record) as a work around for something that is broken.
I'd like to track these resets.
Is there a way to do this with base?
I'm considering writing a C subroutine for this is it doesn't already exist.
Cheers!
dpc