Getting rid of delay

Hi guys, I wrote the sketch up to control a homemade dc pulse motor. It works pretty good as a stand alone sketch, put when I added more code to to print to an lcd and have adjustable delay times the motor goes half speed. I think this is caused by the delays? Any how I was hopping someone could help me get rid of the delay command and show me how to use milli.

// constants won't change. They're used here to set pin numbers
#include <Button.h>                     // http://www.arduino.cc/playground/Code/Button

Button Trig1 = Button (14,PULLUP);      // sets analog pin 0 as Trig-1 input, also pulled up
Button Trig2 = Button (15, PULLUP);     // sets analog pin 1 as Trig-2 input, also pulled up 
const int Drive1 = 16;                  // sets analog pin 2 as Drive-1 output 
const int Drive2 = 17;                  // sets analog pin 3 as Drive-2 output 
void setup(){


pinMode (16, OUTPUT);               // this is output for Drive-1
pinMode (17, OUTPUT);               // this is output for Drive-2
}
void loop()
{
  if (Trig1.isPressed()){           // reads the Trigger 1 input and switches Drive-1
   // delay ();                     // may need for delayed pulse and tuning
    digitalWrite (16, HIGH);
    delay (2);                      // this is the amount of time the Drive-1 pulse is ON
    digitalWrite (16, LOW);         // forces Drive-1 low...no motor pulse
   // delay (2);                    // allows for longer trigger pulse in time
  }else{
    digitalWrite (16,LOW);          // keeps Drive-1 LOW
  }
  if (Trig2.isPressed()){           // reads the Trigger 2 input and switches Drive-2
    //delay ();                     // may need for delayed pulse and tuning
    digitalWrite (17, HIGH);
    delay (2);                      // this is the amount of time the Drive-2 pulse is ON
    digitalWrite (17, LOW);         // forces Drive-2 low...no motor pulse
    //delay ();                     // allows for longer trigger pulse in time
  }else{
    digitalWrite (17, LOW);         // keeps Drive-2 LOW
  }
}

Then I modified another sketch to get the adjustable times. 

will post code in new post.

Here is sketch with adjustable timeing

//  Initialising screen:
#define TITLE_LINE_1 "    Bedini-O    "
#define TITLE_LINE_2 " 1.0 by Rawbush "

////////////////////////////////////////////////////////////////////////////////
//  Includes
#include <stdlib.h>
#include <stdio.h>
#include <avr/interrupt.h>
#include <avr/io.h>
#include <LCD4Bit_mod.h>   // The library files <LCD4Bit_mod.h> can be found here:
                           // http://www.nuelectronics.com
#include <Wire.h>          // include Wire library for I2C
#include <EEPROM.h>        // for persistent system state
#include <Button.h>        // http://www.arduino.cc/playground/Code/Button
///////////////////////////////////////////////////////////////////////////////////////////
// FUNCTION TEMPLATES:                                                                   //
//                                                                                       //
// This is a Template taken directly from arduino.cc/playground/Code/EEPROMWriteAnything //
// This creates two functions that will allow us to save 'Confiuration' data. The data   //
// will be stored in a Structure that will contain ALL of the values that we use so      //
// that there is only one 'Save' and one 'Read' required.                                //
///////////////////////////////////////////////////////////////////////////////////////////
template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
    const byte* p = (const byte*)(const void*)&value;
    int i = 0;
    for (i = 0; i < sizeof(value); i++)
        EEPROM.write(ee++, *p++);
    return i;
}

template <class T> int EEPROM_readAnything(int ee, T& value)
{
    byte* p = (byte*)(void*)&value;
    int i = 0;
    for (i = 0; i < sizeof(value); i++)
        *p++ = EEPROM.read(ee++);
    return i;
}
// END FUNCTION TEMPLATES:

////////////////////////////////////////////////
//  Macros                                    //
////////////////////////////////////////////////
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif

#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

///////////////////////////////////////////////////////////////////////
// Constants:                                                        //
// This is where you would setup, add or change  some Default values //
///////////////////////////////////////////////////////////////////////

Button Trig1 = Button (15,PULLUP);      // sets analog pin 0 as Trig-1 input, also pulled up
Button Trig2 = Button (16, PULLUP);     // sets analog pin 1 as Trig-2 input, also pulled up 
const int Drive1 = 17;                  // sets analog pin 2 as Drive-1 output 
const int Drive2 = 18;                  // sets analog pin 3 as Drive-2 output 

const int MIN_D1D1 = 0;  // Drive-1/Delay-1 min delay time in ms
const int MAX_D1D1 = 10; //Drive-1/Delay-1 max delay time in ms

const int MIN_D1D2 = 0;  // Drive-1/Delay-2 min delay time in ms
const int MAX_D1D2 = 10; //Drive-1/Delay-2 max delay time in ms

const int MIN_D2D1 = 0;  // Drive-2/Delay-1 min delay time in ms
const int MAX_D2D1 = 10; //Drive-2/Delay-1 max delay time in ms

const int MIN_D2D2 = 0;  // Drive-2/Delay-2 min delay time in ms
const int MAX_D2D2 = 10; //Drive-2/Delay-2 max delay time in ms

const int LCD_WIDTH = 16; // just some values for the 2 line 16 char display
const int LCD_HEIGHT = 2;

const int NUM_CURSOR_POSITIONS = LCD_WIDTH; // sets the number of cursor positions

const int MS_SCREEN_RESTART = 5000;  //used to restart the LCD to get out of screwups

/////////////////////////////////////////////////////////////////////////////////
// These next set of  variables are used as a small lookup table. The cursor   //
// will be setting at a position on the display from 0-15. Depending on which  //
// Menu item we are wanting to change/modify we will 'Look' at this table for  //
// the correct muliplier at the given Cursor position.                         //
/////////////////////////////////////////////////////////////////////////////////
const long aDelayMultipliers[NUM_CURSOR_POSITIONS] = {
  0,0,0,0,0,0,0,0,0,0,0,0,10,1,0,0};  //Delay multipliers
 
const long alSaveButtonEmulator[NUM_CURSOR_POSITIONS] = {
  0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0};//only  position 4 is use. set 1 wil save settings to eeprom

////////////////////////////////////////////////////
// Menu Items:                                   //
// Add and 'Definition' of new menu itens here.  //
///////////////////////////////////////////////////
enum MENU_ITEMS
{
  MENU_SOFT_RPM  = 0, // Will be used later to display RPM
  MENU_SOFT_D1D1 = 1, // Drive-1/Delay-1 this is used to retard timing
  MENU_SOFT_D1D2 = 2, // This is the amount of time the Drive-1 is pulsed ON in ms
  MENU_SOFT_D2D1 = 3, // Drive-2/Delay-1 this is used to retard timing
  MENU_SOFT_D2D2 = 4, // This is the amount of time the Drive-2 is pulsed ON in ms
  MENU_SAVE_OPTS = 5, // Save All the option settings
  MENU_NUM_ITEMS = 6, //always last one on the 'MENU_ITEMS' stack
};

///////////////////////////////////////////////////////////////////////////////////
// Set some static values for Current Sensor, Frequency and Duty Cycle.          //
// NOTE: Static values are values that do not change unless forced to.           //
///////////////////////////////////////////////////////////////////////////////////




////////////////////////////////////////////////////
// Variables:                                     //
////////////////////////////////////////////////////
int iMenuSelect = 0;      //use to select each menu item

int RPM;     //RPM
int D1D1;    //Drive-1 Delay-1
int D1D2;    //Drive-1 Delay-2
int D2D1;    //Drive-2 Delay-1
int D2D2;    //Drive-2 Delay-2



int iSaveSettingVal[1];// Force a write to eeprom of all the current settings.

int iCursorPosition;  //the current  cursor position

bool bCursorUp;       // state of the bottom line cursor
bool bRedrawLine1;    // set true whenever you want the LCD to refresh line1
bool bRedrawLine2;    // set true whenever you want the LCD to refresh line2
bool UseFcnPWM;

/////////////////////////////////////////////////////
// Set up the IO, A/D and PWM pins on the Arduino  //
/////////////////////////////////////////////////////


long previousMillis = 0;        // will store last Delay Time
long previousRefresh = 0;       // will store last Display Refresh Time 


///////////////////////////////////////////////////////////////////////////
// STRUCTURES:                                                           //
//                                                                       //
// This structure will contain ALL of the parameter and variables        //
// that we will want to maintain in a consistant state even if the       //
// Arduino is powered off. This Strucure can contain as many elements    //
// as we desire and we can Add to it at any time. The Item in the        //
// structure must caontain item of the same TYPE that we are using for   //
// a given 'Option'. Example: if we define a variable/option as a LONG   //
// then we must have a cooresponding element in the structure define as  //
// a LONG as well.                                                       //
//                                                                       //
// NOTE: The current structure is just a place holder for the moment-RRB //
///////////////////////////////////////////////////////////////////////////
struct config_t
{
    ///////////////////////////////////////////////////////////////////////
    // Please note: it is ok to use the same name here because these are //
    // Outside the 'Regular Scope' of the main program. It is nice       //
    // because it make it easier to 'Match' up with a cooresponding      //
    // Value/variable.                                                   //
    ///////////////////////////////////////////////////////////////////////
    
    int D1D1;    //Drive-1 Delay-1
    int D1D2;    //Drive-1 Delay-2
    int D2D1;    //Drive-2 Delay-1
    int D2D2;    //Drive-2 Delay-2
      
} configuration;

//END STRUCTURES:

//////////////////////////////////////////////////////////////////
// Objects:                                                     //
//////////////////////////////////////////////////////////////////
LCD4Bit_mod lcd = LCD4Bit_mod(LCD_HEIGHT);//LCD handling object

///////////////////////////////////////////////////////
// Initialise                                        //
///////////////////////////////////////////////////////

void setup()
{ 
  ////////////////////////////////////////
  // start serial port Added by AllGood //
  ////////////////////////////////////////
  Serial.begin(9600);
  UseFcnPWM = true;
  
  //Set Drive pins
  pinMode (17, OUTPUT);               // this is output for Drive-1
  pinMode (18, OUTPUT);               // this is output for Drive-2


continues on next post

continued

 /////////////////////////////////////////////////////////////////////////
  // Before we do anything else Read the Configuration Structure and     //
  // preset all the Option Values currently used in the progam for each  //
  // each function.                                                      //
  ////////////////////////////////////////////////////////////////////////// 
  // EEPROM_readAnything(0, configuration);
  
  if(EEPROM_readAnything(0, configuration) <=0) // If no data is returned then nothing is saved
  {
    D1D1 = 0;  // This is the startup Drive-1 Delay-1 change to whatever
    D1D2 = 02;  // This is the startup Drive-1 Delay-2 change to whatever
    D2D1 = 0;  // This is the startup Drive-2 Delay-1 change to whatever
    D2D2 = 02;  // This is the startup Drive-2 Delay-2 change to whatever
    
    iSaveSettingVal[0] = 0; // This sets the PSEUDO Save to 'Not Pushed'
     
  }
  else
  {
    ///////////////////////////////////////////////////////////////////////
    // Configuration data was saved so we are able to load the structure //
    // and from there we are able to load all the various variables with //
    // the stored data.                                                  //
    ///////////////////////////////////////////////////////////////////////
    D1D1 = configuration.D1D1;
    D1D2 = configuration.D1D2;
    D2D1 = configuration.D2D1;
    D2D2 = configuration.D2D2;  
    iSaveSettingVal[0] = 0;
  }

    //////////////////////////////////////////////////////////////
    // insure that the returned values are within a valid range //
    //////////////////////////////////////////////////////////////
    if(D1D1 > 10 ||  D1D1 < 0) // This is the startup Drive-1 Delay-1 change to whatever
      D1D1 = 0; 
      
    if(D1D2 > 10 ||  D1D2 < 0) // This is the startup Drive-1 Delay-2 change to whatever
      D1D2 = 02;
      
     if(D2D1 > 10 ||  D2D1 < 0) // This is the startup Drive-2 Delay-1 change to whatever
      D2D1 = 0; 
      
     if(D2D2 > 10 ||  D2D2 < 0) // This is the startup Drive-2 Delay-2 change to whatever
      D2D2 = 02; 
    
    
    
    ////End Check Retuned Values ///////////////////////////////////////
    
  ////////////////////////////////////////////////////////////
  // GUI/Display state:                                     //
  // These are the values that are displayed upon startup.  //
  // The values can be changed at any time but they should  //
  // be set here to some minimal startup values.            //
  ////////////////////////////////////////////////////////////
  

  bCursorUp = true;     // Initilize to a start up value

  //show then splash screen:
  lcd.init();
  
  lcd.printIn(TITLE_LINE_1);
  lcd.cursorTo(2,0);
  lcd.printIn(TITLE_LINE_2);

  delay(5000); //Delay function is alright to use in setup. It does not affect the
               //rest of the program
  
  //display  Menu screen:
  iCursorPosition = 0;   // Set Cursor to the first position on the LCD screen.
  RedrawLine1();         // Draw/Paint the first line of the display
  RedrawLine2();         // Draw/Paint the Second line of the display
  bRedrawLine1 = false;  // Trun Off the 'Force Redraw' so that it is not
  bRedrawLine2 = false;  // imediately redrawn in the Main Loop
}

///////////////////////////////////////////
//  Main Loop:                           //
///////////////////////////////////////////
void loop()
{
  //Poll Triggers
  PollTriggers();
  
  //poll keypad
  PollKeyPad();
   
  //Poll Save Settings
  PollSaveSettings();
  
  
  //look for a screen refresh for line 1:
  if(bRedrawLine1)
  {
    bRedrawLine1 = false; // Turn the 'Do Refresh' signal off
    RedrawLine1();
  }

  //look for a screen refresh for line 2:
  if(bRedrawLine2)
  {
    bRedrawLine2 = false;
    RedrawLine2();
  }
  
  delay(10);  // pause slightly: may be able to eliminate this delay...
  
}
///////////////////////////////////////////////////////////
//  This polls the triggers and signals the motor pulses //
///////////////////////////////////////////////////////////
void PollTriggers (void)
{  
  if (Trig1.isPressed()){           // reads the Trigger-1 input and switches Drive-1
    delay (D1D1);                     // may need for delayed pulse and tuning
    digitalWrite (17, HIGH);
    delay (D1D2);                      // this is the amount of time the Drive-1 pulse is ON
    digitalWrite (17, LOW);         // forces Drive-1 low...no motor pulse
                      
  }else{
    digitalWrite (17,LOW);          // keeps Drive-1 LOW
    
    //break;
  }
  if (Trig2.isPressed()){           // reads the Trigger-2 input and switches Drive-2
    delay (D2D1);                     // may need for delayed pulse and tuning
    digitalWrite (18, HIGH);
    delay (D2D2);                      // this is the amount of time the Drive-2 pulse is ON
    digitalWrite (18, LOW);         // forces Drive-2 low...no motor pulse
    
  }else{
    digitalWrite (18, LOW);         // keeps Drive-2 LOW
  }
}

  // break;
  //default:                      // may need these
  //break;





////////////////////////////////////////////////////
//  This polls the buttons on the 2 line display  //
////////////////////////////////////////////////////
void PollKeyPad(void)
{
  static int iKeyOld = -1;
  int iKeyNew = GetKeyVal();
  bool exitFlag = false;
  
  if(iKeyOld != iKeyNew)
  {
    if(!bCursorUp)
    {
      bCursorUp = true;
      bRedrawLine2 = true;
    }

    delay(5);//wait for ADC value to settle; delay is ok here too

    iKeyNew = GetKeyVal();

    switch(iKeyNew)
    {
    case 0: // Right Button Selected:
      IncCursor(true);
      break;
    case 1: // Up Button Selected:
      if(iCursorPosition != 0)
        IncrDecrVal(true);   //Call the function to Increment the value

        break;
    case 2: // Down Button Selected:
      if(iCursorPosition != 0)
        IncrDecrVal(false);  //Call the function to Increment the value

        break;
    case 3: // Left Button Selected:
      IncCursor(false);
      break;
    case 4: // Enter/Select Button Selected:
      if(++iMenuSelect >= MENU_NUM_ITEMS) // select the next menu item
        iMenuSelect = 0;// if no more menu items go back to the begining
       
        //exitFlag = false;
        previousRefresh = millis(); // Save last time a refresh ocurred.
        bRedrawLine1 = true;//Force LCD update

      break; 
    default:
      break;
    }
    
    iKeyOld = iKeyNew; // save the last button selected.
  }
}
//////////////////////////////////////////////////////
//  function to determing which button was pressed  //
//////////////////////////////////////////////////////
int GetKeyVal(void)
{
  const int PIN_ADC_KEYPAD = 0; // Pin 0 is used here. DO NOT USE it anywhere ales
  const int NUM_KEYS = 5;       // Set the number of 'usable' buttons
  
  // look up table of values returned
  static int aiKeyVal[NUM_KEYS] ={30, 150, 360, 535, 760}; 
    
  // for each of the 5 push buttons
  int iRaw = analogRead(PIN_ADC_KEYPAD);
  
   // loop through and look for which button was pushed
  for(int k = 0; k < NUM_KEYS; k++)
  {
    if(iRaw < aiKeyVal[k])
      return k;    // pass back the 'Key' value to the 'Calling Function'
  }
  return -1;
}

//////////////////////////////////////////////
//  Increment/Decrement cursor position     //
//////////////////////////////////////////////
void IncCursor(bool bInc)
{
  if(bInc)
  {  //increment
    if(++iCursorPosition >= NUM_CURSOR_POSITIONS)
      iCursorPosition = 0; // if cursor at the last position move it to the first position
  }
  else
  {  //decrement
    if(--iCursorPosition < 0)
      iCursorPosition = NUM_CURSOR_POSITIONS-1; // move cursor to the last position
  }
  bRedrawLine2 = true;//Force LCD update
}
[code]

 
  continues on next post

continued

/////////////////////////////////////////////////////////////////////////////////
// Display the 'current' menu item and any values that may have been changed   //
//                                                                             //
// NOTE: Since the Disply is only 16 characters long it is relatively easy     //
//       to keep track of where each character should be displayed. Therefore  //
//       I have kept this section very simple so that other MENU items can be  //
//       added and manipulated easily and without complication.                //
//                                                                             //
//       Also NOTE that by Hard coding values instead of using variables save  //
//       processing time by not having to do Arithmetic computations.          //
/////////////////////////////////////////////////////////////////////////////////
void RedrawLine1(void)
{
  static char pStr[LCD_WIDTH + 1];//line buffer
  //static char tmpStr1[LCD_WIDTH + 1];//line buffer
  //static char tmpStr2[LCD_WIDTH + 1];//line buffer

 
  float ibaseValue = 0;
  float iremainderVal  = 0;
  float fAmpVal = 0;
  
  ////////////////////////////////
  // Current Menu Items         //
  ////////////////////////////////
  // 1) RPM  =  0000            //
  // 2)Drive1 D1  00ms          //
  // 3)Drive1 D2  00ms          //
  // 4)Drive2 D1  00ms          //
  // 5)Drive2 D2  00ms          //
  // 6) 0 Save Option           //
  ////////////////////////////////

  switch(iMenuSelect)
  {
    case 0: //First Menu item - RPM

      ///////////////////////////////////////////////
      // MENU ITEM TO DISPLAY: "1)  RPM  =  0000"  //
      ///////////////////////////////////////////////
      
      sprintf(pStr, "1)  RPM  =  %04d%",RPM);
      
      break;
      
    case 1: //Second Menu item - Drive-1 Delay-1

      ///////////////////////////////////////////////
      // MENU ITEM TO DISPLAY: "2)Drive1 D1 00ms"  //
      ///////////////////////////////////////////////
      
      sprintf(pStr, "2)Drive1 D1 %02dms%",D1D1);
     
      break;
      
     case 2: //Third Menu item - Drive-1 Delay-2

      ///////////////////////////////////////////////
      // MENU ITEM TO DISPLAY: "3)Drive1 D2 00ms"  //
      ///////////////////////////////////////////////
      
      sprintf(pStr, "3)Drive1 D2 %02dms%",D1D2);
      
      break;

    case 3: //Forth Menu item - Drive-2 Delay-1

      ///////////////////////////////////////////////
      // MENU ITEM TO DISPLAY: "4)Drive2 D1 00ms"  //
      ///////////////////////////////////////////////
      
      sprintf(pStr, "4)Drive2 D1 %02dms%",D2D1);
      
      break;
      
    case 4: //Fith Menu item - Drive-2 Delay-2

      ///////////////////////////////////////////////
      // MENU ITEM TO DISPLAY: "5)Drive2 D2 00ms"  //
      ///////////////////////////////////////////////
      
      sprintf(pStr, "5)Drive1 D2 %02dms%",D2D2);
      
      break;
      
    case 5: // Sixth menu item is used initate a SAVE option. When changed from 0 to 1 a write to 
            // eeprom is initiated. This can be looked at as a PSEUDO Save Button
      /////////////////////////////////////////////
      // MENU DISPLAY ITEM: "6) 0 Save Option"  //
      ////////////////////////////////////////////
      sprintf(pStr, "6) %01d Save Option",iSaveSettingVal[0]);
      
      break;
    default:
      break;
  }
  //Print it:
  lcd.cursorTo(1,0);           // move cursor to line 1 position 1
  lcd.printIn(pStr);           // print/disply the resulting string
  previousRefresh = millis();  // save the last time the display was 'Refreshed'
}

/////////////////////////////////////
//  Draw line 2 string with cursor //
/////////////////////////////////////
void RedrawLine2(void)
{
  int iCursorPos;
  iCursorPos = iCursorPosition;

  static char pStr[LCD_WIDTH + 1];//line buffer

  for(int i=0; i < LCD_WIDTH; i++)
  {
    if(i == iCursorPos)
    {
      if(bCursorUp)
        pStr[i] = '^';
      else
        pStr[i] = 'o';
    }
    else
    {
      pStr[i] = ' ';
    }
  }
  lcd.cursorTo(2,0);
  lcd.printIn(pStr);
}

void IncrDecrVal(bool bInc)
{
  switch(iMenuSelect)
  {
    case 1:
      if(iCursorPosition > 11)
      {
        if(bInc)
          D1D1 += aDelayMultipliers[iCursorPosition];
        else
          D1D1 -= aDelayMultipliers[iCursorPosition];
      }

      break;
    
    case 2:
      if(iCursorPosition > 11)
      {
        if(bInc)
          D1D2 += aDelayMultipliers[iCursorPosition];
        else
          D1D2 -= aDelayMultipliers[iCursorPosition];
      }

      break;
    
    case 3:
      if(iCursorPosition > 11)
      {
        if(bInc)
          D2D1 += aDelayMultipliers[iCursorPosition];
        else
          D2D1 -= aDelayMultipliers[iCursorPosition];
      }

      break;
    
    case 4:
      if(iCursorPosition > 11)
      {
        if(bInc)
          D2D2 += aDelayMultipliers[iCursorPosition];
        else
          D2D2 -= aDelayMultipliers[iCursorPosition];
      }

      break;
    
      
    case 5:
      if(iCursorPosition < 5)
      {
        if(bInc)
        {
          iSaveSettingVal[0] += alSaveButtonEmulator[iCursorPosition];
          RedrawLine1();
        }
          
      }
      break;
  }

  if(D1D1 > MAX_D1D1)
    D1D1 = MAX_D1D1;

  if(D1D2 > MAX_D1D2)
    D1D2 = MAX_D1D2;
    
  if(D2D1 > MAX_D2D1)
    D2D1 = MAX_D2D1; 
   
  if(D2D2 > MAX_D2D2)
    D2D2 = MAX_D2D2;  
  
  if(D1D1 < MIN_D1D1)
    D1D1 = MIN_D1D1;

  if(D1D2 < MIN_D1D2)
    D1D2 = MIN_D1D2;
    
  if(D2D1 < MIN_D2D1)
    D2D1 = MIN_D2D1; 
    
  if(D2D2 < MIN_D2D2)
    D2D2 = MIN_D2D2;
  
   
  bRedrawLine1 = true;//Force LCD update
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////



void PollSaveSettings(void)
{
  ////////////////////////////////////////////////////////////////////////
  // Check to see if the user wants to save their current settings. If  //
  // so then save them and set the value back to zero.                  //
  ////////////////////////////////////////////////////////////////////////
  if( iSaveSettingVal[0] >=1 )
  {
    configuration.D1D1 = D1D1;
    configuration.D1D2 = D1D2; 
    configuration.D2D1 = D2D1;
    configuration.D2D2 = D2D2; 
    EEPROM_writeAnything(0, configuration);

    iSaveSettingVal[0] = 0;
    bRedrawLine1 = true;
  }
  
}

Ok there it all is. Thanks for any help you can offer.