Index: hvcontrol/History.txt
===================================================================
--- hvcontrol/History.txt	(revision 90)
+++ hvcontrol/History.txt	(revision 93)
@@ -17,2 +17,4 @@
 	    option to set usage of DAC values. Instead, a third parameter 'dac'
 	    to the 'hv' and 'hvdiff' commands chooses DAC values.
+24/7/2009   Lockfile is deleted if configuration file cannot be read
+27/7/2009   Slow data is written for every HV ramp to file given in configuration
Index: hvcontrol/Makefile
===================================================================
--- hvcontrol/Makefile	(revision 90)
+++ hvcontrol/Makefile	(revision 93)
@@ -3,7 +3,7 @@
 #
 
-SOURCES = hvcontrol.cpp src/HV.cc src/HVConfig.cc src/HVCalib.cc src/ProcessIO.cc ../pixelmap/Pixel.cc ../pixelmap/PixelMap.cc
+SOURCES = hvcontrol.cpp src/HV.cc src/HVConfig.cc src/HVCalib.cc src/ProcessIO.cc ../pixelmap/Pixel.cc ../pixelmap/PixelMap.cc ../drsdaq/SlowData.cc
 OBJECTS = $(addsuffix .o, $(basename $(SOURCES)))
-INCDIRS   = -I. -I../pixelmap -I./src
+INCDIRS   = -I. -I./src
 
 CPPFLAGS = -O3 -Wall -DOS_LINUX
Index: hvcontrol/hvcontrol.cpp
===================================================================
--- hvcontrol/hvcontrol.cpp	(revision 90)
+++ hvcontrol/hvcontrol.cpp	(revision 93)
@@ -5,13 +5,6 @@
   reads and monitors status of the G-APD HV supply
 
-  Name:         hvcontrol.cpp
-
-  Actions:      Do global initialization, start threads  
-
-  Created by:   Sebastian Commichau, November 2008
-                commichau@phys.ethz.ch
-  Updated by:   Sabrina Stark, June 2008
-                sabrina.stark@phys.ethz.ch
-
+  Sebastian Commichau, Sabrina Stark, Oliver Grimm
+  
 \**************************************************************/
 
@@ -27,5 +20,5 @@
 #include "ProcessIO.h"
 
-#include <readline/readline.h>  // Must be after including ftdi.h!
+#include <readline/readline.h>
 #include <readline/history.h>
 
@@ -48,5 +41,5 @@
 int main(int argc, char *argv[]) {
 
-  char config_file[] = DEFAULT_CONFIG, str[MAX_COM_SIZE];
+  char str[MAX_COM_SIZE];
   pthread_t thread_ConsoleCommand,thread_HVMonitor,thread_CCCommand;
   int LockDescriptor;
@@ -93,5 +86,5 @@
 
   // Construct main instance and create mutex for thread synchronization
-  ProcessIO pio(config_file);
+  ProcessIO pio(argc==3 ? argv[2] : DEFAULT_CONFIG);
   if (pthread_mutex_init(&pio.control_mutex, NULL) != 0) {
     perror("pthread_mutex_init failed");
Index: hvcontrol/src/HV.cc
===================================================================
--- hvcontrol/src/HV.cc	(revision 90)
+++ hvcontrol/src/HV.cc	(revision 93)
@@ -12,16 +12,18 @@
 
 #include "HV.h"
-
+#include "ProcessIO.h" // Must be not in HV.h to avoid problem with declaring class ProcessIO
 
 // Constructor
-HVBoard::HVBoard(int DeviceNumber, char *DeviceName, bool TestMode, float TimeOut, bool verbose) {
+HVBoard::HVBoard(int DeviceNumber, char *DeviceName, class ProcessIO *PIO) {
    
   char Buffer[BUFFER_LENGTH];
   struct termios tio;
  
-  fTestMode = TestMode;
+  m = PIO;
+
+  fTestMode = m->config->TestMode;
   fTestModeWrap = 0;
-
-  SetTimeOut(TimeOut);
+  
+  SetTimeOut(m->config->fTimeOut);
   BoardNumber = DeviceNumber;
   BoardName = DeviceName;
@@ -42,5 +44,5 @@
   snprintf(Buffer, BUFFER_LENGTH, "/dev/%s",DeviceName);
   if ((fDescriptor = open(Buffer, O_RDWR|O_NOCTTY|O_NDELAY)) == -1) {
-    if(errno != 2) printf("Error: Could not open device %d/%s (%s)\n", DeviceNumber,DeviceName, strerror(errno));
+    if(errno != 2) m->PrintMessage("Error: Could not open device %d/%s (%s)\n", DeviceNumber,DeviceName, strerror(errno));
     return;
   }
@@ -48,12 +50,12 @@
   // Get current serial port settings
   if (tcgetattr(fDescriptor, &tio) == -1) {
-    printf("tcgetattr(...) failed (%d/%s)\n", errno, strerror(errno));
+    m->PrintMessage("Error: tcgetattr() failed (%d/%s)\n", errno, strerror(errno));
     return;   
   }
 
   // Set baudrate and raw mode
-  if (cfsetspeed(&tio, BAUDRATE) == -1) printf("Error: Could not set baud rate (%s)\n", strerror(errno));
+  if (cfsetspeed(&tio, BAUDRATE) == -1) m->PrintMessage("Error: Could not set baud rate (%s)\n", strerror(errno));
   cfmakeraw(&tio);
-  if (tcsetattr(fDescriptor, TCSANOW, &tio ) == -1) printf("Errsor with tcsetattr(...) (%s)\n", strerror(errno));
+  if (tcsetattr(fDescriptor, TCSANOW, &tio ) == -1) m->PrintMessage("Error: tcsetattr() failed (%s)\n", strerror(errno));
 
   //  Synchronize HV board (if fails, closes device and sets fDescriptor to -2) 
@@ -62,6 +64,6 @@
   
   while(++trial<=3) {
-    if((ret = Communicate(stdout, &wbuf, 1, verbose)) == 1) {
-      Reset(stdout, verbose);
+    if((ret = Communicate(&wbuf, 1)) == 1) {
+      Reset();
       return;
     }
@@ -77,5 +79,5 @@
 HVBoard::~HVBoard() {
   if(fDescriptor >= 0 && !fTestMode) {
-    Reset(stdout, false);
+    Reset();
     close(fDescriptor);
   }
@@ -86,5 +88,5 @@
 //
 // Returns: 0 read error, 1 success, -1 fTimeOut exceeded
-int HVBoard::Communicate(FILE* fptr, unsigned char* wbuf, int Bytes, bool verbose) {
+int HVBoard::Communicate(unsigned char* wbuf, int Bytes) {
 
   unsigned char rbuf;
@@ -94,10 +96,10 @@
   // === Write data ===
   if (write(fDescriptor, wbuf, Bytes) < Bytes) {
-    fprintf(fptr," Error: could not write (all) data to HV board\n");
-    return 0;
-  }
-  if (verbose) {
-    fprintf(fptr,"%d bytes written:\n", Bytes);
-    for (int i=0; i<Bytes; i++) fprintf(fptr," Byte %d: %#.2x\n",i,wbuf[i]);
+    m->PrintMessage("Error: could not write (all) data to HV board\n");
+    return 0;
+  }
+  if (m->Verbose) {
+    m->PrintMessage("%d bytes written:\n", Bytes);
+    for (int i=0; i<Bytes; i++) m->PrintMessage(" Byte %d: %#.2x\n",i,wbuf[i]);
   }
 
@@ -106,15 +108,15 @@
   struct timeval WaitTime = {(long) fTimeOut, (long) ((fTimeOut-(long) fTimeOut)*1e6)};
   if (select(fDescriptor+1, &SelectDescriptor, NULL, NULL, &WaitTime)==-1) {
-    printf("Error with select() (%d/%s)\n", errno,strerror(errno));
+    m->PrintMessage("Error with select() (%d/%s)\n", errno,strerror(errno));
     return 0;
   }
   // Time-out expired?
   if (!FD_ISSET(fDescriptor, &SelectDescriptor)) {
-    if (verbose) printf("Time-out of %.2f seconds expired while reading\n", fTimeOut);
+    if (m->Verbose) m->PrintMessage("Time-out of %.2f seconds expired while reading\n", fTimeOut);
     return -1;
   }
   // Read error?    
   if ((ret = read(fDescriptor, &rbuf, 1)) == -1) {
-    fprintf(stderr, " Read error (%s)\n", strerror(errno));
+    m->PrintMessage("Read error (%s)\n", strerror(errno));
     return 0;
   }
@@ -129,5 +131,5 @@
   ResetButton = (bool) (rbuf & 0X80);
 
-  if (verbose && ret==1) fprintf(fptr," 1 byte read: %#.2x\n", rbuf);  
+  if (m->Verbose && ret==1) m->PrintMessage(" 1 byte read: %#.2x\n", rbuf);  
   
   return 1;
@@ -136,5 +138,5 @@
 
 /* Reset HV board - uses TRead() and has same return values */
-int HVBoard::Reset(FILE* fptr, bool verbose) {
+int HVBoard::Reset() {
   
   if (fTestMode) return 1; 
@@ -143,5 +145,5 @@
   int ret;
   
-  if((ret = Communicate(fptr, wbuf, 3, verbose)) == 1) ClearVoltageArrays();  
+  if((ret = Communicate(wbuf, 3)) == 1) ClearVoltageArrays();  
   return ret;
 }
@@ -149,5 +151,5 @@
 
 /* Read status register - uses TRead() and has same return values */
-int HVBoard::GetStatus(FILE* fptr, bool verbose) {
+int HVBoard::GetStatus() {
 
   if (fTestMode) return 1;
@@ -155,13 +157,13 @@
   unsigned char wbuf[] = {REG_STATUS,0,0};
   
-  return Communicate(fptr, wbuf, 3, verbose);
+  return Communicate(wbuf, 3);
 }
 
 
 /* Set high voltage - uses TRead() and has same return values */
-int HVBoard::SetHV(FILE* fptr, int chain, unsigned int channel, unsigned int hv, bool verbose) {
+int HVBoard::SetHV(int chain, unsigned int channel, unsigned int hv) {
 
   if (fTestMode){
-    printf("Test mode: Nothing to be done. \n");
+    m->PrintMessage("Test mode: Nothing to be done. \n");
     return 1;
   }
@@ -170,5 +172,5 @@
 
   if (!(hv>=0 && hv<=0x3FFF)) {
-    fprintf(fptr," Error: HV beyond limits [0 - 0x3FFF]\n"); 
+    m->PrintMessage(" Error: HV beyond limits [0 - 0x3FFF]\n"); 
     return 0;
   }
@@ -180,5 +182,5 @@
     case 3: wbuf[0] = REG_HV3; break;
 
-    default : fprintf(fptr," Error: chain %d does not exist\n",chain); return 0;
+    default : m->PrintMessage(" Error: chain %d does not exist\n",chain); return 0;
   }
  
@@ -189,5 +191,5 @@
   wbuf[2] |= (unsigned char)(hv & 0X000000FF);              // Add [D7-D0]
    
-  return Communicate(fptr, wbuf, 3, verbose);
+  return Communicate(wbuf, 3);
 }
 
Index: hvcontrol/src/HV.h
===================================================================
--- hvcontrol/src/HV.h	(revision 90)
+++ hvcontrol/src/HV.h	(revision 93)
@@ -9,5 +9,5 @@
 #include <sys/ioctl.h>
 
-#include <HVConfig.h>
+#include "HVConfig.h"
 
 #define BAUDRATE B115200
@@ -18,5 +18,4 @@
 #define REG_HV2     0X30
 #define REG_HV3     0X38
-
 #define REG_RESET   0XF8
 #define REG_STATUS  0X80
@@ -27,7 +26,7 @@
 #define BIT_OC2    (1<<5)
 #define BIT_OC3    (1<<6)
-
 #define BIT_RESET  (1<<7)
 
+class ProcessIO;
 
 class HVBoard {
@@ -36,8 +35,9 @@
    int fTestModeWrap;
    bool fTestMode;
-
+   class ProcessIO *m;
+   
  public:
   
-   HVBoard(int, char *, bool, float, bool);
+   HVBoard(int, char *, class ProcessIO *);
    ~HVBoard();
 
@@ -54,9 +54,9 @@
 
    void ClearVoltageArrays();
-   int Reset(FILE*, bool);
-   int GetStatus(FILE*, bool);
-   int SetHV(FILE*, int, unsigned int, unsigned int, bool);
+   int Reset();
+   int GetStatus();
+   int SetHV(int, unsigned int, unsigned int);
    int GetBoardNumber() {return BoardNumber;}
-   int Communicate(FILE*, unsigned char*, int, bool);
+   int Communicate(unsigned char*, int);
    void SetTimeOut(double);
 };
Index: hvcontrol/src/HVConfig.cc
===================================================================
--- hvcontrol/src/HVConfig.cc	(revision 90)
+++ hvcontrol/src/HVConfig.cc	(revision 93)
@@ -14,23 +14,15 @@
 
 
-HVConfig::HVConfig(FILE* fptr, char *configfile) {
+HVConfig::HVConfig(const char *configfile) {
 
-  fLogFile   = new char[BUFFER_LENGTH];
   fUSBDevice = new char*[MAX_NUM_HVBOARDS];
 
-  fPixMapTable = new char[BUFFER_LENGTH];
-    
   for (int i=0; i<MAX_NUM_HVBOARDS; i++) {
     fUSBDevice[i]      = new char[BUFFER_LENGTH];
     USBDeviceNumber[i] = 0;
-
-    for (int j=0; j<NUM_CHAINS; j++) {
-      for (int k=0; k<2; k++) Coef[i][j][k] = 0.;
-    }
   }
 
   TestMode           = false;
   NumHVBoards        = 0;
-  FileName           = configfile;
   fStatusRefreshRate = 1.;
   fTimeOut           = 1.;
@@ -39,25 +31,7 @@
   fHVCalibOffset      = -.8;
   fHVCalibSlope       = 0.0064;
-  fHVMaxDiff          = 1;  
-
-  if (configfile != NULL) {
-    if (!ReadHVConfig(fptr, configfile)) {
-      fprintf(fptr, "Error (HVConfig): could not configure HV control\n");
-      exit(1);
-    }
-  }
-}
-
-
-HVConfig::~HVConfig() {
-
-  delete [] fLogFile;	delete [] fPixMapTable;
-  for (int i=0; i<MAX_NUM_HVBOARDS; i++) delete [] fUSBDevice[i];
-  delete [] fUSBDevice;
-}
-
-
-int HVConfig::ReadHVConfig(FILE* fptr, char *configfile) {
-
+  fHVMaxDiff          = 1;
+  
+  // Read configuration file
   FILE *f;
   char str[MAX_COM_SIZE], dev[MAX_COM_SIZE];
@@ -65,11 +39,13 @@
 
   if ((f = fopen(configfile,"r")) == NULL) {
-    fprintf(fptr,"Could not open configuration file: %s\n", configfile);
-    return 0;
+    printf("Could not open configuration file: %s\n", configfile);
+    throw;
   }
-  else fprintf(fptr,"Opening configuration file: %s\n", configfile);
+  else printf("Opening configuration file: %s\n", configfile);
  
-  ReadCard("LogFile",    fLogFile,    's',f);
-  ReadCard("PixMapTable",fPixMapTable,'s',f);
+  ReadCard("LogFile",       fLogFile,    's',f);
+  ReadCard("PixMapTable",   fPixMapTable,'s',f);
+  ReadCard("SlowDirectory", fSlowDir,	 's',f);
+  
   ReadCard("TestMode",   &str,        's',f);
   if (!strcmp(str,"TRUE")) TestMode = true;
@@ -95,31 +71,13 @@
 
   fclose(f);
-  return 1;
 }
 
 
-int HVConfig::PrintHVConfig(FILE *fptr) {
-  
-  fprintf(fptr," \n HV control configuration (%s):\n\n", FileName);
-  fprintf(fptr," Log file:          %s\n", fLogFile);
-  fprintf(fptr," Pixel map table:   %s\n", fPixMapTable);
-  fprintf(fptr," Test mode:         %s\n", TestMode ? "yes" : "no");
-  fprintf(fptr," %d USB devices:\n", NumHVBoards);
-  
-  for (int i=0;i<NumHVBoards;i++) 
-    fprintf(fptr," Board%d: %s\n", USBDeviceNumber[i], fUSBDevice[i]);
-  
-  fprintf(fptr,"\n");
-  fprintf(fptr," TimeOut:           %.2f s\n",   fTimeOut);
-  fprintf(fptr," StatusRefreshRate: %.2f Hz\n",fStatusRefreshRate);
-  fprintf(fptr," CCPort:            %d\n",       fCCPort);
-  fprintf(fptr," DACMin value:      %d\n",     DACMin);
-  fprintf(fptr," DACMax value:      %d\n",     DACMax);
-  fprintf(fptr," HVCalibOffset :    %f\n",     fHVCalibOffset);
-  fprintf(fptr," HVCalibSlope :     %f\n",     fHVCalibSlope);
-  fprintf(fptr," HVMaxDiff :        %u\n",     fHVMaxDiff);
- 
-  return 1;
+HVConfig::~HVConfig() {
+
+  for (int i=0; i<MAX_NUM_HVBOARDS; i++) delete [] fUSBDevice[i];
+  delete [] fUSBDevice;
 }
+
 
 // ReadCard function (original version by F. Goebel)
Index: hvcontrol/src/HVConfig.h
===================================================================
--- hvcontrol/src/HVConfig.h	(revision 90)
+++ hvcontrol/src/HVConfig.h	(revision 93)
@@ -25,9 +25,6 @@
  public:
 
-  HVConfig(FILE* fptr, char *configfile=NULL);
+  HVConfig(const char *);
   ~HVConfig();
-
-  int ReadHVConfig(FILE* fptr, char *configfile);
-  int PrintHVConfig(FILE* fptr);
 
   int NumHVBoards;
@@ -38,11 +35,9 @@
   bool TestMode;
 
-  float Coef[MAX_NUM_HVBOARDS][NUM_CHAINS][2];
- 
-  char*  FileName;
-  char*  fLogFile;
+  char   fLogFile[BUFFER_LENGTH];
+  char   fSlowDir[BUFFER_LENGTH];
   char** fUSBDevice;
 
-  char*  fPixMapTable;
+  char   fPixMapTable[BUFFER_LENGTH];
  
   float  fTimeOut;
@@ -56,5 +51,4 @@
   
   unsigned int  fHVMaxDiff;
-
 };
 
Index: hvcontrol/src/ProcessIO.cc
===================================================================
--- hvcontrol/src/ProcessIO.cc	(revision 90)
+++ hvcontrol/src/ProcessIO.cc	(revision 93)
@@ -14,5 +14,6 @@
 static char* state_str[]    = {"active", "stopped", "n.a."};
 
-ProcessIO::ProcessIO(char *ConfigFile) {
+
+ProcessIO::ProcessIO(const char *ConfigFile) {
 
   // Get program start time
@@ -20,5 +21,5 @@
 
   // Create instances
-  config = new HVConfig(stdout,ConfigFile);
+  config = new HVConfig(ConfigFile);
   calib  = new HVCalib(config);
   pm 	 = new PixelMap(config->fPixMapTable);
@@ -44,10 +45,10 @@
   if(config->TestMode){
     fprintf(stdout,"Test mode: One HVBoard initialized as dummy.\n");
-    fHVBoard[NumHVBoards] = new HVBoard(0, 0, config->TestMode, config->fTimeOut, Verbose);
+    fHVBoard[NumHVBoards] = new HVBoard(0, 0, this);
     NumHVBoards++;
   }
   else {
     for (int i=0; i<config->NumHVBoards; i++) {
-      fHVBoard[NumHVBoards] = new HVBoard(config->USBDeviceNumber[i], config->fUSBDevice[i], config->TestMode, config->fTimeOut, Verbose);
+      fHVBoard[NumHVBoards] = new HVBoard(config->USBDeviceNumber[i], config->fUSBDevice[i], this);
       if(fHVBoard[NumHVBoards]->fDescriptor >= 0) {
          printf("Synchronized and reset HV board %d (%s)\n",i,config->fUSBDevice[i]);
@@ -66,6 +67,11 @@
   PrintMessage(MsgToLog,"********** Logging started **********\n");
 
-  // Print configuration to log file
-  if(Logfile) config->PrintHVConfig(Logfile);
+  // Create instance of slow data class
+  SlowDataClass = new SlowData("HV", config->fSlowDir);
+  if (SlowDataClass->ErrorCode != 0) {
+    PrintMessage("Warning: Could not open slowdata file (%s)\n", strerror(SlowDataClass->ErrorCode));
+  }
+  SlowDataClass->NewEntry("Value-Info", "Issued if new HV value set successfull: Board-Num HV-Board-Name Chain Channel DAC-Target Converted-Value");
+  SlowDataClass->NewEntry("Error-Info", "Issued if error occurs when trying to set new HV value: Board-Num HV-Board-Name Chain Channel Attempted-DAC-Target Converted-Value");
 }
 
@@ -75,5 +81,5 @@
   for (int i=0; i<NumHVBoards; i++) delete fHVBoard[i];
 
-  delete config;    delete pm;
+  delete SlowDataClass;   delete config;    delete pm;
   
   if(Logfile != NULL) {
@@ -156,7 +162,24 @@
   // Print HV utility configuration
   else if (Match(Param[0], "config")) {
-
-    config->PrintHVConfig(stdout);
-    
+    PrintMessage( " Log file:          %s\n"
+    	    	  " Pixel map table:   %s\n"
+    	    	  " Test mode:         %s\n"
+    	    	  " %d USB devices:\n", config->fLogFile, config->fPixMapTable,
+		  config->TestMode ? "yes" : "no", config->NumHVBoards);  
+    for (int i=0;i<NumHVBoards;i++) { 
+      PrintMessage(" Board%d: %s\n ", config->USBDeviceNumber[i], config->fUSBDevice[i]);
+    }
+    PrintMessage( "\n TimeOut:           %.2f s\n"
+    	    	  " StatusRefreshRate: %.2f Hz\n"
+    	    	  " CCPort:            %d\n"
+    	    	  " DACMin value:      %d\n"
+    	    	  " DACMax value:      %d\n"
+    	    	  " HVCalibOffset :    %f\n"
+    	    	  " HVCalibSlope :     %f\n"
+    	    	  " HVMaxDiff :        %u\n", config->fTimeOut,
+		  config->fStatusRefreshRate, config->fCCPort, config->DACMin,
+		  config->DACMax, config->fHVCalibOffset, config->fHVCalibSlope,
+		  config->fHVMaxDiff);
+
     return;
   }
@@ -287,6 +310,4 @@
     }
 	
-    StopMonitor();
-
     while (fgets(Buffer, sizeof(Buffer), File) != NULL) {
       for (int Board=0; Board<NumHVBoards; Board++) {
@@ -314,6 +335,4 @@
     } // while()
     	    
-    StartMonitor();
-    	
     if (NBoards != NumHVBoards) {
       PrintMessage("Warning: Could not load HV settings for all connected HV boards\n");
@@ -333,6 +352,4 @@
     double Rate;
     
-    if (!NumHVBoards) return;
-
     if (NParam != 2) {
       PrintMessage("Usage: rate <Hz>\n");
@@ -351,8 +368,6 @@
     }
 
-    StopMonitor();
     fStatusRefreshRate = Rate;
     PrintMessage("Refresh rate set to %.2f Hz\n", fStatusRefreshRate);
-    StartMonitor();
 
     return;
@@ -363,8 +378,5 @@
 
     if (!NumHVBoards) return;
-
-    StopMonitor();
-    ResetActiveBoards();
-    StartMonitor();
+    for (int i=FirstBoard; i<=LastBoard; i++) ResetBoard(i);
     return;
   }
@@ -416,9 +428,7 @@
   else if (Match(Param[0], "start")) {
 
-    if (!NumHVBoards) return;
-    
-    StartMonitor();
+    state = active;
+    pthread_kill(HVMonitor, SIGUSR1);
     PrintMessage("OK - status monitoring activated\n");
-
     return;  
   }
@@ -463,7 +473,6 @@
   else if (Match(Param[0], "stop")) {
 
-    if (!NumHVBoards) return;
-    
-    StopMonitor();    
+    state = stopped;
+    pthread_kill(HVMonitor, SIGUSR1);
     PrintMessage("Status monitor stopped\n");
 
@@ -594,11 +603,9 @@
 bool ProcessIO::RampVoltage(unsigned int Target, int Board, int Chain, int Channel) {
 
-  int Diff;
-  
   while (fHVBoard[Board]->HV[Chain][Channel] != (int) Target) {	  
-    Diff = Target - fHVBoard[Board]->HV[Chain][Channel];
+    int Diff = Target - fHVBoard[Board]->HV[Chain][Channel];
     if (Diff > (int) config->fHVMaxDiff) Diff = config->fHVMaxDiff;
 
-    if (fHVBoard[Board]->SetHV(stdout, Chain, Channel, fHVBoard[Board]->HV[Chain][Channel]+Diff, Verbose)==1) {
+    if (fHVBoard[Board]->SetHV(Chain, Channel, fHVBoard[Board]->HV[Chain][Channel]+Diff) == 1) {
       fHVBoard[Board]->HV[Chain][Channel] += Diff;
 
@@ -610,29 +617,21 @@
     else {
       PrintMessage("ERROR - Could not set HV of board %d, chain %d, channel %d. Skipping channel\n",fHVBoard[Board]->GetBoardNumber(),Chain,Channel);
+      SlowDataClass->NewEntry("Error");
+      SlowDataClass->AddToEntry("%s %d %d %d %d %.2f ",fHVBoard[Board]->BoardName,Board, Chain, Channel, Target, calib->DACToHV(Target,Board,Chain,Channel));
       return false;
     }
   }
+  SlowDataClass->NewEntry("Value");
+  SlowDataClass->AddToEntry("%s %d %d %d %d %.2f ",fHVBoard[Board]->BoardName,Board, Chain, Channel, Target, calib->DACToHV(Target,Board,Chain,Channel));
   return true;
 }
 
-void ProcessIO::StartMonitor() {
-
-  state = active;
-  pthread_kill(HVMonitor, SIGUSR1);
-}
-
-
-void ProcessIO::StopMonitor() {
-
-  state = stopped;
-  pthread_kill(HVMonitor, SIGUSR1);
-}
-
-
+
+// Check board status
 void ProcessIO::Monitor() {
 
   for (int i=0; i<NumHVBoards; i++) {
 
-    if (fHVBoard[i]->GetStatus(stdout,false)!=1) {
+    if (fHVBoard[i]->GetStatus() != 1) {
       PrintMessage("Error: Monitor, could not read status of board %d\n", fHVBoard[i]->GetBoardNumber());
     }
@@ -653,17 +652,13 @@
       }
     }
-  }
-}
-
-
-void ProcessIO::ResetActiveBoards() {
-  
-  for (int i=FirstBoard; i<=LastBoard; i++) ResetBoard(i);
-}
-
-
+    
+  }
+}
+
+
+// Send reset to board and clear voltage arrays
 void ProcessIO::ResetBoard(int i) {
     
-  if (fHVBoard[i]->Reset(stdout,Verbose) == 1) {
+  if (fHVBoard[i]->Reset() == 1) {
     PrintMessage("Reset of board %d\n", fHVBoard[i]->GetBoardNumber());
     PrintBoardStatus(i);
@@ -673,4 +668,5 @@
 
 
+// Get index of board with sequential number board
 int ProcessIO::GetBoardIdx(int board) {
 
@@ -681,5 +677,5 @@
 }
 
-
+// Print current board status
 void ProcessIO::PrintBoardStatus(int i) {
 
@@ -716,4 +712,5 @@
 }
 
+
 // Check if two strings match (min 1 character must match)
 bool Match(const char *str, const char *cmd) {
@@ -721,4 +718,5 @@
 }
 
+
 // Convert string to double
 // Returns false if conversion did not stop on whitespace or EOL character
Index: hvcontrol/src/ProcessIO.h
===================================================================
--- hvcontrol/src/ProcessIO.h	(revision 90)
+++ hvcontrol/src/ProcessIO.h	(revision 93)
@@ -12,4 +12,5 @@
 #include "HV.h"
 #include "../pixelmap/PixelMap.h"
+#include "../drsdaq/SlowData.h"
 
 #define MAX_NUM_TOKEN 10
@@ -32,5 +33,6 @@
   HVCalib     *calib;
   HVBoard* fHVBoard[MAX_NUM_HVBOARDS];
-
+  SlowData* SlowDataClass;
+  
   pthread_mutex_t control_mutex;
 
@@ -58,5 +60,5 @@
     
   // Methods
-  ProcessIO(char *);
+  ProcessIO(const char *);
   ~ProcessIO();
 
@@ -66,13 +68,8 @@
   void CommandControl(char*);
   bool RampVoltage(unsigned int, int, int, int);
-  void StartMonitor();
-  void StopMonitor();
   void Monitor();
-  void ResetActiveBoards();
   void ResetBoard(int);
   int GetBoardIdx(int);
-
   void PrintBoardStatus(int);
-
   int ParseInput(char*, const char *Param[]);
 };
