user serial lcd and serial datalogger (vdip1)

I have a multi digital gauge/sensor project going that works pretty well now. It has a usb logging mode that logs all parameters, comma delimited to a connected laptop. I'd like to change this so it logs to a usb key. I've been investigating using a vdip1 from ftdi (http://apple.clickandbuild.com/cnb/shop/ftdichip?op=catalogue-products-null&prodCategoryID=57&title=VDIP1, Arduino Playground - UsbMemory).

There is one problem...I use a serial lcd module (one of the sparkfun ones). Normally during usb logging mode I shut off the lcd display using it's command set for this purpose and turn it back on upon exiting the mode. Since both the LCD module and vdip1 are going to be receiving the same signals from the serial port could there be problems. I'm guessing there are only probs if the command sets overlap??

They both easily use 9600 baud.
The display uses

Serial.print(0xFE, BYTE);   //command flag
 Serial.print(0x08, BYTE);  //shut the screen off command

to shut the screen off and otherwise only sees things immediately following 0xFE as commands.

The logger uses command line-like commands to do things like open/close files and write to files:

Serial.print("OPW LOG%");                  // open to write creates a file - named
  Serial.print(fileNumber);                  // LOG%1.TXT first time round - .TXT is for the computer
  Serial.print(".TXT");           
  Serial.print(13, BYTE);                    // return character

These are terminated by a return character.

writing to a file is like this:

 Serial.print("WRF ");               //write to file (file needs to have been opened to write first)
               Serial.print(noOfChars);            //needs to then be told how many characters will be written
               Serial.print(13, BYTE);             //return to say command is finished
               Serial.print(activityToLog);        //followed by the info to write
               Serial.print(valToWrite);
               Serial.print(13, BYTE);             //write a return to the contents of the file (so each entry appears on a new line)

The full set of commands for the vdip1 are available in the documentation and I don't think i'll be using any of these when writing to the screen. It should only be block's 3 letter words and such. I wonder if the vdip1 err's on getting nonsense commands or just ignores them???

According to the sparkfun LCDserial tutorial if you send the pipe character (0x7C) to the lcd plus some random integer you can overwrite the module and screw things up. I want to prevent doing things like this.

The only truly safe way I can think of doing this is by triggering a NC relay that opens (shutting off the lcd) when I want to datalog.

I included all the code...yes its a mess and yes it took a bunch of posts to put up. The last post has the usb datalogger function.

//takes accelerometer data and displays it on the lcd screen.
//includes peaks and zeroing at startup

//also a replacement for gauges
//set up for 2 display
//also set up for 1 and bar graph display

//multi mode selection via the "A" button
//"B" button clears peaks and operates the usb logging as well as the timer function

int xval = 4;
int yval = 5;
int negpeak = 0;
int pospeak = 0;
int pospeakcount = 0;
int negpeakcount = 0;
int zerogy = 512;
int zerogx = 512;

unsigned long T1 = 0;
unsigned long T2 = 0;

int mode = 1; 
int buttonApin = 12;
int buttonBpin = 13;
int buttonBval = HIGH;

int t1pin = 2;
int t2pin = 3;
int tempPin = 1;
int boostPin = 0;

int timer_state = 0;
long tempmillisT1 = 0;
long tempmillisT2 = 0;

boolean startuptempswitch = false;

//global peaks...so that you can switch modes and preserve peaks
long boost_peak = 0;
long temp_peak = 0;
long temp1_peak = 0;
long temp2_peak = 0;

  
void setup(){
  //setup the accelerometer and screen
  Serial.begin(9600);

  backlightOn(); 
  //zero the accelerometer...but only for small tilts
  int tempreading = analogRead(yval);
  if ((tempreading < 600) && (tempreading > 400)){
    zerogy = tempreading;
  }
  else {
    zerogy = 512;
  }
  tempreading = analogRead(xval);
  if ((tempreading < 600) && (tempreading > 400)){
    zerogx = tempreading;
  }
  else {
    zerogx = 512;
  }
  //setup the buttons as inputs
  pinMode(buttonApin, INPUT);
  pinMode(buttonBpin, INPUT);
}

void loop (){
  //WHAT MODE
  if (digitalRead(buttonApin) == LOW){
    while (digitalRead(buttonApin)){
     //avoids flipping modes rapidly 
    }
     if (mode == 1){mode=2;}
     else if (mode == 2){mode=3;}
     else if (mode == 3){mode=4;}
     else if (mode == 4){mode=5;}
     else if (mode == 5){mode=6;}
     else if (mode == 6){mode=7;}
     else mode = 1;
  }
  //ACCELEROMETER
 if (mode == 2) {
    accelerometer();
 }
 //LAP TIMER 
 if (mode == 5){
   runTimer();
 } 
 if (mode == 1){
  temp_meter(); 
 }
 if (mode == 3){
  boost_meter(); 
 }
 if (mode == 4){
  temp_boost_meter(); 
 }
 if (mode == 6){
   two_temp_meter();
 }
 if (mode == 7){
   usb_logger();
 }
 
}

void test_all_meters(){
/* if (analogRead(tempPin) > 512){ //oil temp
   mode = 1;
   temp_meter();
 } 
 if (analogRead(t1pin) > 512){ //temp1
   mode = 6;
   two_temp_meter();
 }
 if (analogRead(t2pin) > 512){ //temp2
   mode = 6;
   two_temp_meter();
 }*/
 if ( (lookup_boost(analogRead(boostPin))) >  140){ //boost
   mode = 3;
   boost_meter();
 }
 return;
}

void accelerometer(){
    if (startuptempswitch == true){
     while (digitalRead(buttonApin) == LOW){}
    }
    test_all_meters();
    startuptempswitch = true;
    int accelx = ( getAccelerometerData (xval) );
    int accely = ( getAccelerometerData (yval) );
 
    pospeakcount++;
    negpeakcount++;
  
    peak(accely);
    selectLineOne();
    delay(60);
    printBarGraph(accely);
    selectLineTwo();
    delay(60);
    Serial.print("x:");
    printAccelerometerReadout(accelx);
    Serial.print(" y: ");
    printAccelerometerReadout(accely);
}
void runTimer(){
  while (digitalRead(buttonApin) == LOW){
   }
  test_all_meters();
  if (timer_state == 0){
    clearLCD();
    selectLineOne(); 
    delay(20);
    Serial.print("T1: 00:00:00.00");
    selectLineTwo();
    Serial.print("T2: 00:00:00.00"); 
    T1 = 0;
    T2 = 0;
    while (digitalRead(buttonBpin) == HIGH){
     //wait for start
     if (digitalRead(buttonApin) == LOW){
       return;
     } 
    }
    while (digitalRead(buttonBpin) == LOW){
      //we don't want to skip the start if you hold the button too long
     //timing actually happens on button release 
     timer_state = 1;
     tempmillisT1 = millis();
    }
  }
  if (timer_state == 1){
    clearLCD();
    selectLineOne();
    while (digitalRead(buttonBpin) == HIGH){
      test_all_meters();
      //timing
      if (digitalRead(buttonApin) == LOW){
        return;
      }
      clearLCD();
      T1 = millis() - tempmillisT1;
      //printing to the screen
      print_T1();
      //a short pause
      delay(50);
    }
    while (digitalRead(buttonBpin) == LOW){
      //stop T1 timing
      test_all_meters();
      timer_state = 2;
    }
  }
  if (timer_state == 2){ //timed shown on T1 and zeros on T2 waiting to start T2
    //display T1 if we cycle through modes and reach this
    //---
      clearLCD();
      //printing to the screen
      print_T1();
      //a short pause
      delay(50);
      
      //display T2 as zeros
      selectLineTwo();
      Serial.print("T2: 00:00:00.00"); 
    //---
    
    while (digitalRead(buttonBpin) == HIGH){
     //wait for timing T2
     if (digitalRead(buttonApin) == LOW){
      return;
     } 
     test_all_meters();
    }
    while (digitalRead(buttonBpin) == LOW){
     //clicking to start T2 
      timer_state = 3;
      tempmillisT2 = millis();
    }
  }
  if (timer_state == 3){ //T1 is displayed and T2 is running
    //display T1 if this mode is reache durring mode switching
    //--
      clearLCD();
      //printing to the screen
      print_T1();
      
    //--
    
    delay(10);

    while (digitalRead(buttonBpin) == HIGH){
      test_all_meters();
      if (digitalRead(buttonApin) == LOW){
        return;
       }
      //T2 timing 
      T2 = millis() - tempmillisT2;
      //printing to the screen
      print_T2();
      //a short pause
      delay(50);
    }
    while (digitalRead(buttonBpin) == LOW){
      //click to stop
      timer_state = 4;
    }
  }
  if (timer_state == 4){
    clearLCD();
    while (digitalRead(buttonBpin) == HIGH){ 
      //what to do if we've reached this direct thru mode switching
      //---
        //printing to the screen
        print_T1();
        //a short pause
        delay(50);
      
        //display T2
        print_T2();
        //a short pause
        delay(50);
       
    //---
      test_all_meters();
      if (digitalRead(buttonApin) == LOW){
        return;
      }
    }
    while (digitalRead(buttonBpin) == LOW){}
    //on release return to main loop
    timer_state = 0;
  }
  return;
}
void print_T1 (){
     //printing to the screen
     selectLineOne();
     unsigned long T1millis = T1%1000/10;
     unsigned long T1seconds = T1%60000/1000;
     unsigned long T1minutes = T1%3600000/60000;
     unsigned long T1hours = T1/3600000;
     Serial.print("T1: ");
     printInTens(T1hours);
     Serial.print(":");
     printInTens(T1minutes);
     Serial.print(":");
     printInTens(T1seconds);
     Serial.print(".");
     printInTens(T1millis);
}

void print_T2 (){
     //printing to the screen
     selectLineTwo();
     unsigned long T2millis = T2%1000/10;
     unsigned long T2seconds = T2%60000/1000;
     unsigned long T2minutes = T2%3600000/60000;
     unsigned long T2hours = T2/3600000;
     Serial.print("T2: ");
     printInTens(T2hours);
     Serial.print(":");
     printInTens(T2minutes);
     Serial.print(":");
     printInTens(T2seconds);
     Serial.print(".");
     printInTens(T2millis);
}

void boost_meter(){ 
 while (digitalRead(buttonApin) == LOW){}
 clearLCD();
 selectLineOne();
 Serial.print("Boost Meter");
 delay(1000);
 clearLCD();
 long reading = 0;
 while (digitalRead(buttonApin) == HIGH){
  test_all_meters();
  if (digitalRead(buttonBpin) == LOW) {
    boost_peak = 0;
  }  
  //non sensor code
  //reading = reading + 1;
  //real reading code
  //0 psi = 12 Vcount;
  reading = lookup_boost( long(analogRead(boostPin)) );
  boost_peak = max (reading, boost_peak); 
  generic_bar_display ("psi", 170, reading, boost_peak, 145);
  delay(50);    
 }
 return;
}

void temp_meter(){ 
 if (startuptempswitch == false){
  while (digitalRead(buttonApin) == LOW){}
 }
 clearLCD();
 delay(10);
 selectLineOne();
 Serial.print("Oil Temp Meter");
 delay(1000);
 clearLCD();
 long reading = 0;
 while (digitalRead(buttonApin) == HIGH){
  test_all_meters(); 
  if (digitalRead(buttonBpin) == LOW) {
    temp_peak = 0;
  }
  //reading = reading + 1;
  reading = lookup_oil_temp(analogRead(tempPin));

  if ((startuptempswitch == false) && (reading > 145)){
    mode = 2;
    return;
  }
  temp_peak = max (temp_peak, reading);
  generic_bar_display ("oil", 3500, reading, temp_peak, 2600);
  delay(50);    
 }
 return;
}

void temp_boost_meter(){ 
 while (digitalRead(buttonApin) == LOW){}
 clearLCD();
 selectLineOne();
 Serial.print("Temp/Boost Meter");
 delay(1000);
 clearLCD();
 long reading1 = 0;
 long reading2 = 0;
 while (digitalRead(buttonApin) == HIGH){
  test_all_meters();
  if (digitalRead(buttonBpin) == LOW) {
    temp_peak = 0;
    boost_peak = 0;
  }
  //reading1 = random(100,350);
  reading1 = lookup_oil_temp(analogRead(tempPin));
  reading2 = lookup_boost( long(analogRead(boostPin)) );
  temp_peak = max (temp_peak, reading1);
  boost_peak = max (boost_peak, reading2); 
  generic_dual_display ("tmp", 3500, reading1, temp_peak, 2000, "psi", 210, reading2, boost_peak, 140);
  delay(50);    
 }
 return;
}
void two_temp_meter(){ 
 while (digitalRead(buttonApin) == LOW){}
 clearLCD();
 selectLineOne();
 Serial.print("2 Temp Meter");
 delay(1000);
 clearLCD();
 long reading1 = 0;
 long reading2 = 0;
 while (digitalRead(buttonApin) == HIGH){
  test_all_meters();
  if (digitalRead(buttonBpin) == LOW) {
    temp1_peak = 0;
    temp2_peak = 0;
  }
  //reading2 = temp_table[10];
  reading2 = analogRead(t1pin);
  reading1 = lookup_temp((long)analogRead(t1pin));
  //reading1 = analogRead(t1pin);
  temp1_peak = max (temp1_peak, reading1);
  temp2_peak = max (temp2_peak, reading2); 
  generic_dual_display ("F 1", 1024, reading1, temp1_peak, 9999, "F 2", 3500, reading2, temp2_peak, 1000);
  delay(20);    
 }
 return;
}

void printInTens(int Tvar){
    if (Tvar < 10){
      Serial.print("0");
      Serial.print(Tvar);
    }
    else Serial.print(Tvar);
    return;
}

void printBarGraph(int y) { 
  //clear the 1st 8 spaces
  if ( y >= 0){
    Serial.print("        ");  
    for(int i=1; i <= y/16; i++){
       Serial.print(0xFF, BYTE);
    }
    //fill the rest with spacesloo
    for(int i=1; i <= (8-y/16); i++){ 
      Serial.print(" "); 
    }
  }
  if (y < 0) {
    //1 - print spaces at the beginning
    for (int i=1; i <= (8-abs(y/16)); i++){
      Serial.print(" "); 
    }
    //2 - print blocks till the middle
    for (int i=1; i <= abs(y/16); i++){
      Serial.print(0xFF, BYTE);
    }
    //3 - print spaces till the end
    for (int i=1; i<=8; i++){
      Serial.print(" ");
    }
  }
 
 //print the peaks if there are any
 //negative
 selectLineOne();
 if (negpeak/16 < 0){
   Serial.print(0xFE, BYTE);
   int npos = 128 + (8 - abs(negpeak/16));
   Serial.print(npos, BYTE);
   Serial.print(0xFF, BYTE);
 }
 
 //positive
 if (pospeak/16 > 0){
   Serial.print(0xFE, BYTE);
   int ppos = 128 + (8 + (pospeak/16));
   Serial.print(ppos, BYTE);
   Serial.print(0xFF, BYTE);
 }
  
}

long lookup_boost(long boost){
  //boost = ( (boost-106000) / 259000 );
  // boost = ( (( boost * 398) / 1000) + 2); //2 is the y intercept
  //398 changed to 378 for slope...because slope was too steep
  boost = ( (( boost * 378) / 1000) - 4); ///10; //get rid of the divide by ten when adding decimals on display
  return boost;
}

long lookup_oil_temp(long tval){
  tval = tval * 1000; //added an extra 0
  if (tval <= 11500){
    return (9999); 
  }
  if (tval >= 68100){
    return (0);
  }
  if ((tval <= 68000)&&(tval > 39600)){
    return (long)(((tval-134266)*10)/(-473));
  }
  if ((tval <= 39600)&&(tval > 28200)){
    return (long)(((tval-115600)*10)/(-380));
  }
  if ((tval <= 28200)&&(tval > 19700)){
    return (long)(((tval-93366)*10)/(-283));
  }  
  if ((tval <= 19700)&&(tval > 11600)){
    return (long)(((tval-54800)*10)/(-135));
  }  
}

long lookup_temp(long tval){
  tval = tval * 100;
  //tval = (long)(tval - (long)117588);
  //return tval;
  if (tval < 8900){
   return (9999); 
  }
  if (tval > 96000){
    return (0);
  }
  if ((tval <= 96000)&&(tval > 93221)){
    return (((tval-101577)*10)/(-172));
  }
  if ((tval <= 93221)&&(tval > 89610)){
    return (((tval-104201)*10)/(-226));
  }
  if ((tval <= 89610)&&(tval > 85125)){
    return (((tval-107738)*10)/(-280));
  }
  if ((tval <= 85125)&&(tval > 79139)){
    return (((tval-112264)*10)/(-335));
  }
  if ((tval <= 79139)&&(tval > 70799)){
    return (((tval-117588)*10)/(-388));
  }
  if ((tval <= 70799)&&(tval > 62470)){
    return (((tval-121441)*10)/(-421));
  }
  if ((tval <= 62470)&&(tval > 53230)){
    return (((tval-122367)*10)/(-428));
  }
  if ((tval <= 53230)&&(tval > 43707)){
    return (((tval-118651)*10)/(-405));
  }
  if ((tval <= 43707)&&(tval > 36471)){
    return (((tval-111349)*10)/(-366));
  }
  if ((tval <= 36471)&&(tval > 30685)){
    return (((tval-102232)*10)/(-321));
  }
  if ((tval <= 30685)&&(tval > 24800)){
    return (((tval-9078)*10)/(-270));
  }
  if ((tval <= 24800)&&(tval > 20000)){
    return (((tval-78575)*10)/(-220));
  }
  if ((tval <= 20000)&&(tval > 15851)){
    return (((tval-66507)*10)/(-175));
  }
  if ((tval <= 15851)&&(tval > 12380)){
    return (((tval-55300)*10)/(-137));
  }
  if ((tval <= 12380)&&(tval > 9085)){
    return (((tval-41752)*10)/(-94));
  }
}
void printAccelerometerReadout(int reading){
  if (reading >= 0 ) {
    Serial.print("+");
  }
  if (reading < 0) {
    Serial.print("-");
  }
  
  int afterdecimal = reading % 100;
  Serial.print(abs(reading/100));
  if ( (afterdecimal > 9) || (afterdecimal < -9) ){
    Serial.print(".");
  }
  else {
    Serial.print(".0");
  }
  Serial.print(abs(afterdecimal));
}

int getAccelerometerData (int axis){
  int zerog = 512;
  if (axis == 5){
   zerog = zerogy;
  }
  if (axis == 3){
   zerog = zerogx; 
  }
    
  int rc = analogRead(axis);
  int top =( (zerog - rc) ) ; 
  float frtrn = (((float)top/(float)158)*100);  //158Vint jumps are 1g
  int rtrn = (int)frtrn;
  return rtrn;
}

void peak(int val){
  
  if ( (val > 0) && (val > pospeak) ){       //pos peak compare and set
      pospeak = val;
      pospeakcount = 0;
  }
 
  if ( (val < 0) && (val < negpeak) ) {     //neg peak compare and set 
       negpeak = val;
       negpeakcount = 0;
  }
  
  else {                                    //peak mark expires after x time
    if (pospeakcount >= 20){
      pospeakcount = 0;
      pospeak = 0;
    }
    if (negpeakcount >= 20){
      negpeakcount = 0;
      negpeak = 0;
    }
  }
}

int numberofdigits(long value){
 
 int digits = 1;
 while (value/10 > 0){
  value = value/10;
  digits++; 
 }
 
 if (value < 0){digits ++;}
 return digits; 
}

//positive only value 0 to X
//only 4 char titles (should be changed soon)
//1234567890123456
//TMP 134.5/ 314.5
//psi 14.5 /  14.5 
//oil 1.0  /   1.4
//oil 0.3  /   0.4
void generic_bar_display(char title[ ], long high, long cur_value, long peak, long warn){
  selectLineOne();
  Serial.print(title);
  Serial.print(" ");
  Serial.print(cur_value/10);
  Serial.print(".");
  Serial.print(cur_value%10);
  int ndigits = numberofdigits(cur_value) + 1;
  if (ndigits <= 2){ ndigits = ndigits + 1;}
  for (int i = 0; i < 5 - ndigits; i++) {
   Serial.print(" "); 
  }
  Serial.print("/");
  ndigits = numberofdigits(peak) + 1;
  if (ndigits <= 2){ ndigits = ndigits + 1;}
  for (int i = 0; i < 6 - ndigits; i++){
   Serial.print(" "); 
  }
  Serial.print(peak/10);
  Serial.print(".");
  Serial.print(peak%10);
  if (cur_value > warn){ //blink if warning threshold is met
    selectLineOne();
    delay(300);
    Serial.print ("                ");
    
    //beep if piezo present...add code
    //add warning led if present...add code
  }
  selectLineTwo();
  unsigned long abar = high/16;
  unsigned long n_bars = cur_value/abar;
  if (cur_value <= 0){n_bars=0;}
  for(int i=1; i< n_bars; i++){ 
     Serial.print(0xFF, BYTE);
  }
  for (int i=1; i < (16 - n_bars); i++){
     Serial.print(" "); 
  }
  delay(60);
}

//use only 4 char titles (should be changed soon)
void generic_dual_display (char title1[ ], long high1, long cur_value1, long peak1, long warn1, char title2[ ], long high2, long cur_value2, long peak2, long warn2){
  selectLineOne();
  Serial.print(title1);
  Serial.print(" ");
  Serial.print(cur_value1/10);
  Serial.print(".");
  Serial.print(cur_value1%10);
  int ndigits = numberofdigits(cur_value1) + 1;
  if (ndigits <= 2){ ndigits = ndigits + 1;}
  for (int i = 0; i < 5 - ndigits; i++) {
   Serial.print(" "); 
  }
  Serial.print("/");
  ndigits = numberofdigits(peak1) + 1;
  if (ndigits <= 2){ ndigits = ndigits + 1;}
  for (int i = 0; i < 6 - ndigits; i++){
   Serial.print(" "); 
  }
  Serial.print(peak1/10);
  Serial.print(".");
  Serial.print(peak1%10);
  if (cur_value1 > warn1){ //blink if warning threshold is met
    selectLineOne();
    delay(300);
    Serial.print ("                ");
    
        //beep if piezo present...add code
    //add warning led if present...add code
  }
  selectLineTwo();
  Serial.print(title2);
  Serial.print(" ");
  Serial.print(cur_value2/10);
  Serial.print(".");
  Serial.print(cur_value2%10);
  ndigits = numberofdigits(cur_value2) + 1;
  if (ndigits <= 2){ ndigits = ndigits + 1;}
  for (int i = 0; i < 5 - ndigits; i++) {
   Serial.print(" "); 
  }
  Serial.print("/");
  ndigits = numberofdigits(peak2) + 1;
  if (ndigits <= 2){ ndigits = ndigits + 1;}
  for (int i = 0; i < 6 - ndigits; i++){
   Serial.print(" "); 
  }
  Serial.print(peak2/10);
  Serial.print(".");
  Serial.print(peak2%10);
  if (cur_value2 > warn2){ //blink if warning threshold is met
    selectLineTwo();
    delay(300);
    Serial.print ("                ");
    
       //beep if piezo present...add code
    //add warning led if present...add code
  }
  delay(60);
}

//quad display -- mus use 4 char (incl ":") for each title...ex "PSI:", "TEMP", "POOP", " ETC"
//void generic_quad_display(char title1[], unsigned long reading1, unsigned long warn1, char title2[], unsigned long reading2, unsigned long warn2, char title3[], unsigned long reading3, unsigned long warn3, char title4[], unsigned long reading4, unsigned long warn4){
//  selectLineOne();
//  Serial.print(title1);
  
//}
void usb_logger(){
 while (digitalRead(buttonApin) == LOW){}
 clearLCD();
 selectLineOne();
 Serial.print("USB Logging");
 selectLineTwo();
 Serial.print("Press B"); 
 while (digitalRead(buttonBpin) == HIGH){
   if (digitalRead(buttonApin)==LOW){
     return;
   }
 }
 delay(500);
 clearLCD();
 Serial.print(0xFE, BYTE);   //command flag
 Serial.print(0x08, BYTE);   //turn off visual display
 Serial.print("Data logger: \n");
 Serial.print("T1, T2, Oil Temp, Boost, x accel, y accel\n"); 
 while (digitalRead(buttonBpin) == LOW){}
 while ( (digitalRead(buttonApin) == HIGH) && (digitalRead(buttonBpin) == HIGH) ){
   //logging output
   //get T1 and convert
   Serial.print( (lookup_temp(analogRead(t1pin))) );
   Serial.print(",");
   //get T2 and convert
   //Serial.print( lookup_temp(analogRead(t2pin)) );
   Serial.print("###");
   Serial.print(",");
   //get oil temp and convert
   //Serial.print( analogRead(tempPin) );
   Serial.print( lookup_oil_temp(analogRead(tempPin)));
   Serial.print(",");
   //get boost and convert
   Serial.print( lookup_boost(analogRead(boostPin)));
   //Serial.print("###");
   Serial.print(",");
   //get x accel
   Serial.print(getAccelerometerData (xval));
   Serial.print(",");
   //get y accel
   Serial.print(getAccelerometerData (yval));
   Serial.print("\n");
 }
 while ( (digitalRead(buttonApin) == LOW) && (digitalRead(buttonBpin) == LOW) ){}
 Serial.print(0xFE, BYTE);   //command flag
 Serial.print(0x0C, BYTE);   //turn on visual display
 return;
}

//functions from Serial example
void selectLineOne(){  //puts the cursor at line 0 char 0.
   Serial.print(0xFE, BYTE);   //command flag
   Serial.print(128, BYTE);    //position
}
void selectLineTwo(){  //puts the cursor at line 0 char 0.
   Serial.print(0xFE, BYTE);   //command flag
   Serial.print(192, BYTE);    //position
}
void clearLCD(){
   Serial.print(0xFE, BYTE);   //command flag
   Serial.print(0x01, BYTE);   //clear command.
}
void backlightOn(){  //turns on the backlight to 40% accepts values from 128 (aka off) to 157 (100% on)
    Serial.print(0x7C, BYTE);   //command flag for backlight stuff
    Serial.print(150, BYTE);    //light level.
}
void backlightOff(){  //turns off the backlight
    Serial.print(0x7C, BYTE);   //command flag for backlight stuff
    Serial.print(128, BYTE);     //light level for off.
}
void serCommand(){   //a general function to call the command flag for issuing all other commands   
  Serial.print(0xFE, BYTE);
}

And software serial is the answer...

Thanks for this post guys: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1192596677