SDFileSystem Records
Posted: Tue Apr 22, 2008 10:14 pm
I'm trying to use the Records features of the the SDFilesystem module (4.0.9), but, am getting strange results.
The following code snippet always displays "00000000.000" on my LCD instead of the expected "abcdefghijkl".
Any clues to why?
The following code snippet always displays "00000000.000" on my LCD instead of the expected "abcdefghijkl".
Any clues to why?
Code: Select all
Repeat
Until SD.Init()=errOK
LCD.WriteAt(2,1,"ok ")
DelayMS(250)
// write schedule
LCD.WriteAt(2,1,"deleting ")
SD.DeleteFile("SCHED01.CFG")
LCD.WriteAt(2,1,"creating new ")
SD.NewFile(FSCHEDULE,"SCHED01.CFG")
SD.CloseAll()
LCD.WriteAt(2,1,"opening ")
SD.OpenFileRW(FSCHEDULE,"SCHED01.CFG")
Schedule.PlayOrder=1
Schedule.SequenceFile="abcdefghijkl"
SD.NewRecord(FSCHEDULE,AddressOf(Schedule))
Schedule.PlayOrder=2
Schedule.SequenceFile="12345678.012"
SD.NewRecord(FSCHEDULE,AddressOf(Schedule))
LCD.WriteAt(2,1,"saving ")
SD.SaveAll
SD.CloseAll
Schedule.PlayOrder=99
Schedule.SequenceFile="00000000.000"
LCD.WriteAt(2,1,"opening ")
// read schedule
If SD.OpenFileRW(FSCHEDULE,"SCHED01.CFG") = errOK Then
LCD.WriteAt(2,1,"Reading SCHED01")
If SD.GetRecord(FSCHEDULE,0,AddressOf(Schedule)) = errOK Then
LCD.WriteAt(1,1,Schedule.SequenceFile)
Else
LCD.WriteAt(1,1,"error getRec")
EndIf
Else
LCD.WriteAt(1,1,"Error opening")
End If