Yep, was going to post my code but was on my Android at the time. (btw, I'm looking for a Arduino file viewer/editor for Android )
Anyways, I'm sure there is a better way to read incoming serial than I have, but after some testing everything works until I reach 64 characters.
I stripped everything out just to make sure it wasn't anything else i was doing.
// ****************************************************************
// 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;
byte index = 0;
// ********************** Other Information ***********************
// ********************** Declorations ****************************
//SoftwareSerial LCDserial(7,8);
// ********************** SET UP **********************************
void setup()
{
Serial.begin(9600);
}
void loop()
{
///////////////////////// TO READ SERIAL ////////////////////////
ReadData();
for(i=0; i < SERSIZ; i++)
{
Serial.println(iData[i]);
}
delay(1000);
}
// *********************** FUNCTIONS *******************************
// Read Incoming Data from Tank monitor
void ReadData()
{
while(Serial.available() > 0)
{
//char aChar = Serial.read();
c = Serial.read();
if(c > 47 && c < 58)
{
iTemp = iTemp * 10 + (c - 48);
}
else if(c == ',') // move to next index
{
iData[index] = iTemp;
index++;
iData[index] = '\0';
iTemp = '\0';
}
else if(c == EOP)
{
iData[index] = iTemp;
index++;
iData[index] = '\0';
break;
}
}
index=0;
c = 0;
iTemp = '\0';
}
// End ReadData()
If I send this, 48 characters,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4;
I get back,
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
0 // 25th character is null
But if I send this, 64 characters
13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,3,3,3,3,3,3,3,3;
I get this
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
3
3
3
3
3
3
3
0
0
The 24th character becomes null and it gets worse the more over characters I send.
But I'm completely open to it being me