Embarassing question about writting to a uSD
SteveJo
Posts: 2
I've worked with a uSD with my propeller for well over a year without problem. Unfortunately, the text wraps and edits need to be made to a text file before it can be read into Excel without loss of data.
Lately my files have been hundreds of lines long, which can be managed, but, soon they'll be moving to thousands of lines long.
I have not been able to figure out how to write a carraige return to the end of one of my lines, but, have tried the following:
sdfat.pputs(string(13)
sdfat.pputs(string("\r"))
sdfat.pputc(13)
sdfat.pputs(13)
... and none of them work. I use the fsrw Object.
Does anyone have suggestions??
Thanks,
Steve
Lately my files have been hundreds of lines long, which can be managed, but, soon they'll be moving to thousands of lines long.
I have not been able to figure out how to write a carraige return to the end of one of my lines, but, have tried the following:
sdfat.pputs(string(13)
sdfat.pputs(string("\r"))
sdfat.pputc(13)
sdfat.pputs(13)
... and none of them work. I use the fsrw Object.
Does anyone have suggestions??
Thanks,
Steve
Comments
I haven't used fsrw for a while, but I think it could be done like this:
The carriage return by itself would work if you saved the file first as a .txt file and then "imported" into Excel. If the file is a .csv file, Excel expects to see both the characters mentioned above.
Otherwise if you only write 10 (the line feed) you can open it with wordpad (the text editor inside windows), it should look correct, and then save it back.
With your setup it could work too...
For reference check also:
http://en.wikipedia.org/wiki/Newline
Massimo
I didn't know that windows wanted a 10.
When I did have this problem, I just had a python script read a file in, and save it again - with zero changes. As long as I did this on a windows platform, that computer could read it.
I seem to have only had that problem with .txt files, .csv files worked fine.
I'll read up on it more. Thanks for making me aware of this Steve et al.
I forgot to welcome you!!
Having used the prop for over a year you probably have been around the forum for some time, but nonetheless a welcome is in order.
Massimo
The way I did it was making two DAT entries, one is the excel header (created by making a blank spreedsheet with lables only), and one with data. The program fills the second DAT area with varibles (location of varible in string is a set of pointers. When a new file is created, first the header is written, then each logger update is written (100ms steps). When vehicle stops (below 5mph) logging stops, file is closed. Ready for next file.
These writes are all string writes. I'm using fswr 2.6 so my limit is 32 files which works fine for my needs.
Search projects for sidecar, my code is zipped there.