Welcome
Username or Email:

Password:


Missing Code




[ ]
[ ]
Online
  • Guests: 24
  • Members: 0
  • Newest Member: omjtest
  • Most ever online: 396
    Guests: 396, Members: 0 on 12 Jan : 12:51
Members Birthdays:
All today's birthdays', congrats!
GreySoul (45)
GluD (35)
northern_lightning (41)
w1vlf (67)
louis.haeb (30)


Next birthdays
06/03 mileswaldron (59)
06/04 muze801 (33)
06/05 HVgeek (33)
Contact
If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.


Special Thanks To:
  • Aaron Holmes
  • Aaron Wheeler
  • Adam Horden
  • Alan Scrimgeour
  • Andre
  • Andrew Haynes
  • Anonymous000
  • asabase
  • Austin Weil
  • barney
  • Barry
  • Bert Hickman
  • Bill Kukowski
  • Blitzorn
  • Brandon Paradelas
  • Bruce Bowling
  • BubeeMike
  • Byong Park
  • Cesiumsponge
  • Chris F.
  • Chris Hooper
  • Corey Worthington
  • Derek Woodroffe
  • Dalus
  • Dan Strother
  • Daniel Davis
  • Daniel Uhrenholt
  • datasheetarchive
  • Dave Billington
  • Dave Marshall
  • David F.
  • Dennis Rogers
  • drelectrix
  • Dr. John Gudenas
  • Dr. Spark
  • E.TexasTesla
  • eastvoltresearch
  • Eirik Taylor
  • Erik Dyakov
  • Erlend^SE
  • Finn Hammer
  • Firebug24k
  • GalliumMan
  • Gary Peterson
  • George Slade
  • GhostNull
  • Gordon Mcknight
  • Graham Armitage
  • Grant
  • GreySoul
  • Henry H
  • IamSmooth
  • In memory of Leo Powning
  • Jacob Cash
  • James Howells
  • James Pawson
  • Jeff Greenfield
  • Jeff Thomas
  • Jesse Frost
  • Jim Mitchell
  • jlr134
  • Joe Mastroianni
  • John Forcina
  • John Oberg
  • John Willcutt
  • Jon Newcomb
  • klugesmith
  • Leslie Wright
  • Lutz Hoffman
  • Mads Barnkob
  • Martin King
  • Mats Karlsson
  • Matt Gibson
  • Matthew Guidry
  • mbd
  • Michael D'Angelo
  • Mikkel
  • mileswaldron
  • mister_rf
  • Neil Foster
  • Nick de Smith
  • Nick Soroka
  • nicklenorp
  • Nik
  • Norman Stanley
  • Patrick Coleman
  • Paul Brodie
  • Paul Jordan
  • Paul Montgomery
  • Ped
  • Peter Krogen
  • Peter Terren
  • PhilGood
  • Richard Feldman
  • Robert Bush
  • Royce Bailey
  • Scott Fusare
  • Scott Newman
  • smiffy
  • Stella
  • Steven Busic
  • Steve Conner
  • Steve Jones
  • Steve Ward
  • Sulaiman
  • Thomas Coyle
  • Thomas A. Wallace
  • Thomas W
  • Timo
  • Torch
  • Ulf Jonsson
  • vasil
  • Vaxian
  • vladi mazzilli
  • wastehl
  • Weston
  • William Kim
  • William N.
  • William Stehl
  • Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Forums
4hv.org :: Forums :: Computer Science
« Previous topic | Next topic »   

Logging raw lines of data in sd card through pic microcontroller (wind speed datalogger)

Move Thread LAN_403
TheMerovingian
Fri Apr 24 2009, 01:15PM Print
TheMerovingian Registered Member #14 Joined: Thu Feb 02 2006, 01:04PM
Location: Prato/italy
Posts: 383
I'm learning how to access SPI-based memory cards like SD or MMC. I have found some picbasic routines that work in FAT16 mode, allowing you to create,detele,open,close,reaname files from the PIC. The drawback of those routines is that almost all of the programming memory is used. I don't need a real file sistem, just need to access a file and append some data (#### <tab> ###.##). Anyone of you have esperimented such devices?
Back to top
GeordieBoy
Fri Apr 24 2009, 03:30PM
GeordieBoy Registered Member #1232 Joined: Wed Jan 16 2008, 10:53PM
Location: Doon tha Toon!
Posts: 881
If the card must be readable in a general purpose reader then you will likely have to make the format of the contents conform to some industrial standard.

If the card will only ever be read or written in your own embedded system, then you can store the data any way you like!

Bare in mind though that structures like FAT were invented to allow you to open files, append data, delete data, close files, recover unused storage space etc. So if you need to be able to perform these functions you might end up reinventing FAT in the long run anyway.

-Richie,
Back to top
Bjørn
Fri Apr 24 2009, 04:12PM
Bjørn Registered Member #27 Joined: Fri Feb 03 2006, 02:20AM
Location: Hyperborea
Posts: 2058
I have done some experiments with memory cards. It is possible to open a device (floppy, harddrive, memory card) in raw mode in most operating systems so you read the bytes on the card without any file systems, so the PIC can just write the data directly to the card. I wrote a program for dumping the raw content of a card some time ago, so I should have the source code somewhere.

You can also put a large file on the card that contains a known pattern. Then the PIC can search for the pattern and with some care put the data there and it will appear in the file when you read it on your PC.

So for simple logging no FAT support in the PIC is really needed.
Back to top
GeordieBoy
Fri Apr 24 2009, 07:01PM
GeordieBoy Registered Member #1232 Joined: Wed Jan 16 2008, 10:53PM
Location: Doon tha Toon!
Posts: 881
> You can also put a large file on the card that contains a known pattern. Then the PIC can search for the pattern and with some care put the data there and it will appear in the file when you read it on your PC.

Aren't there things like checksums or CRC's that would also need to be updated when poking values into an existing file in this manner?

Also surely the FAT entry would need to be updated too to indicate the new length of the file when you add more data?

-Richie,
Back to top
Bjørn
Fri Apr 24 2009, 07:42PM
Bjørn Registered Member #27 Joined: Fri Feb 03 2006, 02:20AM
Location: Hyperborea
Posts: 2058
Aren't there things like checksums or CRC's that would also need to be updated when poking values into an existing file in this manner?
There are no software checksums for files, the hardware is responsible for error checking and correction if any.

Also surely the FAT entry would need to be updated too to indicate the new length of the file when you add more data?
You can fill the memory card with one large file, and just write a end of log marker so your PC software knows where the data ends in the file.
Back to top
...
Sat Apr 25 2009, 01:53AM
... Registered Member #56 Joined: Thu Feb 09 2006, 05:02AM
Location: Southern Califorina, USA
Posts: 2445
Yes, if all you need to do is transfer data from your pic to your computer its a lot easier than implementing the whole file system. You can simply format the card fat32, and create a empty text file that fills the partition. The starting address for the file is a constant value (google can tell you where to find it) and the file will be stored contiguously on the partition (just don't write past the end of the file). Then you can simply open the file when you bring the card back to a computer and read your data.
Back to top
Steve Conner
Sat Apr 25 2009, 07:36AM
Steve Conner Registered Member #30 Joined: Fri Feb 03 2006, 10:52AM
Location: Glasgow, Scotland
Posts: 6706
There's also the Vinculum from FTDI. It converts USB memory sticks to a serial interface, handling the FAT file system for you.
Back to top

Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob

Go to:

Powered by e107 Forum System
 
Legal Information
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.