counter r2i

cyclic up counter
Author: Robert Schirmer
License: BSD
Github: rbrt/control/counter r2i.axo

Inlets

bool32.rising trigger

bool32.rising reset

int32 reset to int

Outlets

int32 output

bool32.pulse carry pulse

Parameters

int32 maximum

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

Privacy

© 2024 Zrna Research