last day (15 days later) » 

9:40 PM
0
A: Extract value from .csv file

Sergio FormigginiI think this solution is good. The idea is to convert the CSV file in a binary file (a sequence of floats). After the conversion you may supply the binary file to the MCU and use the function getVal() (below indicated) to read the data. This code converts a file data.csv into a file data.bin: #...

 
thanks it's work :)
 
Good luck, @Fabrice! :)
 
Hi @Sergio I'm back again! I find some bug in the program, I try to fix it but I fail :(
 
What's the kind of bug you found?
 
I have 576 value in a single line
beetwen 1 to 207: right value; 208 to 227: wrong value; 228 to 231: right value,...
 
9:40 PM
If you are using my getVal function you have to take care that the first element is taken using index=0; than to get it you have to call getVal(f,0) where f is the file pointer (FILE *f) and 0 is the index!
I'm not able to help you only with the information you are giving me! I need more clear info.
It may be there's a difference between the floating support of the PC and that implemented on the MCU. How much are the decimal digits you need? How much are the integral digits you need? ... We can use a function based on fixed decimal!
I'm waiting for your reply! ... :)
Have you solved? ...
 
Sorry @Sergio there was a power outage. I made some modification on the code to convert data.csv into a file data.bin
I want to convert those values
 
What's the problem!? ... The converter I wrote should convert them!
The code you are showing me is not the converter! Is the demo to use the converted file! The converter is the file above that you are modifing
 
I just ad a for loop to show the value beetwen 1th and the 290th! try it
 
Ok I'm trying :)
I found all is correct!
 
Are you working with c++ or c?
 
9:40 PM
If you're talking about the difference between value such as 126.019997 and 126.02 you have to modify all float in double that uses twice the space of float, but double has more precision!
I'm working in C, but in this case should be the same!
 
I don't have the problem beetwen float and double, look at what I get drive.google.com/file/d/0B-yuwPiHuyfIaUNlRTlxMlBMRWs/…
 
I'm looking at your results ... but they're very strange!!! On my PC this doesn't happen!
@Fabrice. I think the problem is in the file! I've not the problem you have! Try to rename the file on the usbkey and to copy the converted another time to the usbkey, may be the usbkey is damaged!
 
It's really strange because some value are true!!!
 
That'is the reason I think the problem is in the file! May be the file converted was damaged or the memory area where it is stored is damaged! ... It seems there're some spurious bytes inside the file!
How much byte is longer your bin file? Mine (converting the csv you sent me) is 2316 byte!
@Fabrice. I think this is not the correct place where we may discuss about. I think is better another way! I think email is good! (sirjoblack@hotmail.com)
 

last day (15 days later) »