timeri

measures the time interval between a rising edge on the start input and a rising edge on the stop input
Author: Johannes Taelman
License: BSD
Github: timer/timeri.axo

Inlets

bool32.rising start trigger

bool32.rising stop trigger

Outlets

int32 time interval in k-rate ticks (0.333ms)

Declaration
int32_t trigstart;
int32_t trigstop;
int32_t tc;
int32_t tlatch;
Init
trigstart = 0;
trigstop = 0;
tlatch = 0;
tc = 0;
Control Rate
if ((inlet_start > 0) && !trigstart) {
  tc = 0;
  trigstart = 1;
} else if (!(inlet_start > 0)) {
  trigstart = 0;
}
if ((inlet_stop > 0) && !trigstop) {
  tlatch = tc;
  trigstop = 1;
} else if (!(inlet_stop > 0)) {
  trigstop = 0;
}
outlet_t = tlatch;
tc++;

Privacy

© 2024 Zrna Research