Sorry for late reply, been away mostly, and have no knowledge about SD cards. But after doing some research for another thread, have you tried MeLabs SD Card SAMPLE program sdfs3.pbp?
http://melabs.com/samples/PBP-mixed/sdfs3.htm
Code:
' Write to file
FAT_src[0] = "A" <<-------- Just load up your array as you see fit from element 0
FAT_src[1] = "B"
FAT_src[2] = "C"
FAT_count = 3 <<-------- set to 512
Gosub FSfwrite
Serout2 PORTC.6, 84, [ "Write ", Dec FAT_error, $d, $a]
If (FAT_error != 0) Then Stop
This sample program does it all for you. Just note it's using PBPL and PIC 18 (but you probably already know this).
If you absolutely have to use your own code (for whatever reason), SDFS.PBP might provide insight at what is the correct procedure.
Or am I missing something obvious?
Robert
Bookmarks