   int i;
   for(i=0; i < _sweep_cycles; i++){
       while (_sweep_control_voltage <= _sweep_v_end){
+        SweepSCmd.readSerial(); //process serial commands
+        if (_sweep_abort == true) goto END_SWEEP;
         SampleTimer.update();
       }
       _sweep_voltage_step = -1.0*_sweep_voltage_step;
       while (_sweep_control_voltage >= _sweep_v_start){
+        SweepSCmd.readSerial(); //process serial commands
+        if (_sweep_abort == true) goto END_SWEEP;
         SampleTimer.update();
       }
       _sweep_voltage_step = -1.0*_sweep_voltage_step;
   }
+END_SWEEP:
+  _sweep_abort = false;
   SampleTimer.stop(sampleEvent);
   Serial.print(F("#</CSV_DATA>\n"));
   Serial.print(F("#</VSWEEP>\n"));

#define V_MIN (-V_REF/2.0 + DELTA_V)
#define V_MAX ( V_REF/2.0 - DELTA_V)

//SerialCommand parser
SerialCommand SCmd(MAXCOMMANDS);

//Sample Timer
Timer SampleTimer;

float _sweep_samp_rate = SAMPRATE_DEFAULT; //samples per second
float _sweep_cycles  =  1;


void sweepAbortCommand(){
    Serial.print(F("#<ABORT />\n"));
    _sweep_abort = true;
}

void sweepTickISR(){
  //Serial.print(F("Tick!\n"));
  _sweep_control_voltage += _sweep_voltage_step;
  //change output voltage
  control_DAC.setVoltageOutput(_sweep_control_voltage + V_VGND); //shift to center-rail
}

void sweepSampleCallback(){
