   // Interpret any fully buffered commands
   if (bufi > 1) {
     // NOTE--subcommands are responsible for checking for completeness and consuming input if it is complete!
-    char cmd = buf[1];
-    Serial.println(cmd,DEC);
+    Serial.println(buf[1],DEC);
     Serial.send_now();
-    if      (cmd == '!') start_running();
-    else if (cmd == '$') report_errors();
-    else if (cmd == '?') report_timing();
-    else if (cmd == '>') shift_timing(1);
-    else if (cmd == '<') shift_timing(-1);
-    else if ((cmd >= '0' && cmd <= '9') || (cmd >= 'A' && cmd <= 'N'))
-                         parse_command_on(channels + DEHEXT(cmd), cmd);
-    else if (cmd == '@') parse_command_on(channels + DIG, '@');
-    else if (cmd == '.') abort_and_reset();
-    else if (cmd == '"') reset_parameters();
-    else if (cmd == ':') report_identity();
-    else if (cmd == '*') report_pins();
-    else                 raise_unknown_command_error(cmd, ' ');
+    interpret(buf[1]);
   }
 
   // int r = ARM_DWT_CYCCNT;   // Read cycle count (effectively a 72 MHz clock)


#include <EEPROM.h>
#include <math.h>

int eepsigN = 8;
int idN = 12;
int eN = eepsigN + idN;
byte* eepsig = (byte*)"stim1.0 ";

int lo = LOW;
int hi = HIGH;

  if (running > 0) running = 0;
}


/******************************
** Generic parsing utilities **
******************************/

void die_with_message(const char *msg) {
  int n = strnlen(msg, 63);
  halt_channels();
  Serial.write(msg, n);
  Serial.send_now();
}

void parse_time_error() {
