   pulseHigh(FQ_UD); 
 }
 
+// evaluate encoder spins
 void evaluateRotary() {
 /* encoder routine. Expects encoder with four state changes between detents */
 /* and both pins open on detent */

#define RotEncSwPin 17 // digital pin 17 (a3)

// set up AD9850 pins
#define W_CLK 4 // digital pin 4
#define FQ_UD 5  // digital pin 5
#define DATAPIN 8  // digital pin 8
#define RESET 9  // digital pin 9

// set up comparator inputs
//
//

// set up memory push buttons
#define MEM_BUTTON_START_PIN  10  // digital pin where mem buttons start

  pinMode(DATAPIN, OUTPUT);
  pinMode(RESET, OUTPUT);
  
  
  // Set up Rotary Encoder
  pinMode(A_PIN, INPUT_PULLUP);
  pinMode(B_PIN, INPUT_PULLUP);
  attachInterrupt(0, evaluateRotary, CHANGE);
  attachInterrupt(1, evaluateRotary, CHANGE);
  pinMode(RotEncSwPin, INPUT_PULLUP);
  
  // Set up Output Monitoring
  pinMode(WARN_LED, OUTPUT);
  digitalWrite(WARN_LED, LOW);
  analogReference(INTERNAL);
  threshold = 1023L * THRESHOLD_VOLTAGE / 1100;
  
  // Set up memory buttons
  for (int buttons=0; buttons < NUMBER_MEM_BUTTONS; buttons++) {
