Problem with read.serial chars

Im making a simple program to read values from serial port and save them to file on sd card, also show them in 4x20 lcd. String what im reading looks like this:
2014/10/11;15:44;25,4;26,4;#;99,0;#;2,4;2,4;#;2,4;2,4;0,0;0,0;29,3;0;E;1;1;0;30,8;15014,3;0,1;119,5;0
They are semicolon separated so can be putted to csv file.
So my problem: i cant read correct values, i have in csv file and on lcd values like 104, 52,53,52 but not orginal vaules recived from serial port. I think they must be converted to chars but i don't know how to do this. Can anyone can help me pls ?

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <SPI.h>
#include <SD.h>

LiquidCrystal_I2C lcd(0x27,20,4); 
const int chipSelect = 4;
String inData;

void setup()
{
  lcd.init();                      
  lcd.backlight();
  Serial1.begin(4800);
  lcd.clear();
  delay(300);
  lcd.print("Sprawdzam SD");
  pinMode(10, OUTPUT);
   if (!SD.begin(chipSelect)) {
    lcd.clear();
    lcd.print("Brak karty SD");
    return;
  }
  lcd.clear();
  delay(300);
  lcd.print("Karta SD OK");  
}

void loop()
{
  if (Serial1.available()) {
      delay(100);
      lcd.clear();
      while (Serial1.available() > 0) {
      //lcd.print(Serial1.read());
      File dataFile = SD.open("test.csv", FILE_WRITE);
      char recived = Serial1.read();
      inData += recived;
      if (recived =='\n'){
      dataFile.println(inData);
      lcd.print(inData);  
      dataFile.close();
    }
    }
  }
  
}

What is connected to Serial1?

Once you know that there is data to read, why are you pissing away time doing nothing?

      lcd.print(Serial1.read());

Read an int. Convert that to a string and print it. Does THAT seem reasonable? Or would

char c = Serial.read();
lcd.print(c);

seem more reasonable?

Does it really make sense to read and print one value and then read and save the next value, over and over? Or, would reading one value and printing and saving that value make more sense?

Why you do this:

      lcd.print(Serial1.read());
      File dataFile = SD.open("test.csv", FILE_WRITE);
      char recived = Serial1.read();

and not this:

      char recived = Serial1.read();
       lcd.print(recived);
      File dataFile = SD.open("test.csv", FILE_WRITE);

?

I must read in loop and wait for any string on serial port, i have this data strings in random time values, eg,
can be one by one or even one per minute, i want to collect this data and analyse it later or watch them on 4x20 lcd. It's from solar charge controller made by Steca. I have made an app in Delphi to collect this data but pc working only for collecting this values have no sense, i want make a low power consumption device to do this :slight_smile:
Also :

char recived = Serial1.read();
      inData += recived;

This gives me wrong values , when i send for example "d" i have on lcd value = 100

This gives me wrong values , when i send for example "d" i have on lcd value = 100

Nonsense. That code snippet doesn't display anything on an LCD.

That code snippet also uses the String class which is a bad idea.

this program works but display on lcd chars in ascii. "d" in ascii code is 100.

You might try something like below where the ; is used to delimit the incomming individual data parts. After printing to the LCD and other stuff, write the data part to the file adding the ; back in.

//zoomkat 3-5-12 simple delimited ';' string  
//from serial port input (via serial monitor)
//and print result out serial port

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial delimit test 1.0"); // so I can keep track of what is loaded
}

void loop() {

  //expect a string like 
  //2014/10/11;15:44;25,4;26,4;#;99,0;#;2,4;2,4;#;2,4;2,4;0,0;0,0;29,3;0;E;1;1;0;30,8;15014,3;0,1;119,5;0;
  
  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ';') {
      //do stuff
      Serial.print(readString); //prints string to serial port out
      Serial.println(';');
      readString=""; //clears variable for new input      
     }  
    else {     
      readString += c; //makes the string readString
    }
  }
}