Page 1 of 1

SD cards File read problems

Posted: Mon Dec 28, 2020 1:53 pm
by p.erasmus
Hi Team,

I need help in understanding the way to read a text file saved on a SD Card.

The text file consists of 20 Voltage values from AN0 and the values are the converted to strings Float values of the voltage not the bit value,
example 1.85 ,2.56.4.9. etc
as shown here from the Console buffer when I open the file to read it ,as you can see the string in green ,the coma separator in purple(0x2C) and then there is a value 0x20 which seems to be a space ,I do not know why is this (I am using the write string to file function in code).

P2.jpg
P2.jpg (116.13 KiB) Viewed 4669 times

Now the problem I am having (also not sure how to do this) when reading the file with the stringRead function the first string is returned correctly then the comma is returend and then again the correct string is returned , there is always a miss read between the strings ,

any advise how to work with this SD card reads I will appreciate I have no clue what I am doing :oops:

P3.jpg
P3.jpg (17.17 KiB) Viewed 4669 times

Re: SD cards File read problems

Posted: Mon Dec 28, 2020 11:50 pm
by BenR
Hello Peter,

Is it possible to post a simple example that shows the problem and I'll investigate what might be going wrong for you.

Re: SD cards File read problems

Posted: Tue Dec 29, 2020 3:39 pm
by p.erasmus
Hi Ben

Thanks for your offer,I will make a small project with only this part from main application code.I am sure it is me not understanding how the SD card is populated with the data and how to retrieve it correctly your help will be appreciated :D

Re: SD cards File read problems

Posted: Wed Dec 30, 2020 9:11 am
by p.erasmus
Hi Ben,

Attached a simple read of 6 vales from the file starting at the first value,
you will noticed the first value is correct then it read only the comma(2C) then again a value and so on .

I know it is me doing somethings wrong because of limited knowledge of the SD cards :oops: also please help me understand in the console it shows the file length is 120 bytes when I read the length in the code it shows 512 Why ?

P1.jpg
P1.jpg (13.86 KiB) Viewed 4626 times

SD_file_Read_Test.rar
(9.47 KiB) Downloaded 452 times

Thanks a million for helping out
:D