PaulS:
We need to see your current code. Serial data arrives in it's own time. You have to remove it from the buffer faster than it is placed in the buffer, or you will begin loosing data. delay()s and Serial.print()s cause it to take longer to read all the data.
This is what I am currently working with. It is working but I don't feel confidant that it is correct.
// ****************************************************************
// File Name:
// Version:
// Created By:
// Comments:
// ****************************************************************
// ********************** Version x.xx ****************************
// 03.11.12
// ********************** Consants ********************************
#define EOP ';'
#define SERSIZ 25
// ********************** Included Libraries **********************
//#include <SoftwareSerial.h>
// ********************** Defaults ********************************
// ********************** Analog Input Pins ***********************
// ********************** PWM Output Pins *************************
// ********************** Digital Input Pins **********************
// ********************** Digital Output Pins *********************
// ********************** Output Pins *****************************
// ********************** Sensor Pins *****************************
// ********************** Variables *******************************
int i;
int c;
int Percent[4];
int iData[SERSIZ];
int iTemp = 0;
boolean PrintFlag = false;
int index = 0;
// ********************** Other Information ***********************
// ********************** Declorations ****************************
//SoftwareSerial LCDserial(7,8);
// ********************** SET UP **********************************
void setup()
{
Serial.begin(9600);
}
void loop()
{
///////////////////////// TO READ SERIAL ////////////////////////
if(Serial.available())
ReadData();
if(PrintFlag)
{
for(i=0; i < SERSIZ; i++)
{
Serial.println(iData[i]);
}
PrintFlag = false;
}
}
// *********************** FUNCTIONS *******************************
// Read Incoming Data from Tank monitor
void ReadData()
{
index = 0;
iTemp = 0;
c = 0;
int count = 0;
while(c != EOP)
{
if(count >= 30000)
{
Serial.println("end");
break;
}
c = Serial.read();
if(c > 47 && c < 58)
{
iTemp = iTemp * 10 + (c - 48);
}
else if(c == ',') // move to next index
{
iData[index] = iTemp;
index++;
iTemp = 0;
}
else if(c == EOP)
{
iData[index] = iTemp;
index++;
PrintFlag = true;
break;
}
count++;
}
}
// End ReadData()