 
 //----------------------------------------
 // Handler for pinB interrupts.
+// Note: input signal has been inverted.
 //----------------------------------------
 
 void pinB_isr(void)
 {
-  // sample the pin value
-  byte reading = PIND & 0xC;
-
-  if (reading == B00001100 && bFlag)
+  // sample the pin values for pin 0 to 7
+  byte reading = PIND & 0xC;  //  mask pins of interest
+
+  if ((reading == B00001100) && bFlag)
   { // check that we have both pins at detent (HIGH) and that we are expecting detent on
     // this pin's rising edge
     if (re_down)


void dds_update(Frequency frequency)
{
  // as in datasheet page 12 - modified to include calibration offset
  unsigned long data = (frequency * 4294967296) / (180000000 - VfoClockOffset);


}

//----------------------------------------
// Set the DDS-60 output frequency.
//
// Only set if VFO is online.
//
// Frequency of sinewave (datasheet page 12) will be
// "<sys clock> * <frequency tuning word> / 2^32".
// Rearranging: FTW = (frequency * 2^32) / sys_clock .
//
// 'VfoClockOffset' is the value the 'Calibrate' menu tweaks, initially 0.
