Basic Counter

very basic cyclic up counter
Author: Johannes Taelman
License: BSD
Github: phi/logic/Basic Counter.axo

Inlets

bool32.rising trigger

Outlets

int32 output

Parameters

int32 maximum

Declaration
int ntrig;
int rtrig;
int count;
Init
count = 0;
ntrig = 0;
rtrig = 0;
Control Rate
if ((inlet_trig > 0) && !ntrig) {
  count += 1;
  if (count >= param_maximum) {
    count = 0;
  }
  ntrig = 1;
} else if (!(inlet_trig > 0))
  ntrig = 0;

outlet_o = count;

Privacy

© 2024 Zrna Research