SDFileReader

Want to test your SD Card? This simple program shows how to read a *.hex file from the SD card and dump to the screen using the Firewing built in 232 to USB interface. You can view the data by pressing "F4" in the Firewing IDE to open the Serial Communicator Window.

Imports SD

'program entry point...
sub Main()
   ' filename and data byte...
   dim filename as string = "data.hex"  
   dim dataByte as byte

   ' initialise the SD card...
   If SD.Init <> errOK Then 
      Console.Write("Failed to initialise",13,10)

   ' now open the file - can be on FAT16 or FAT32...
   elseif SD.Open(Filename) <> errOK then
      Console.Write("Failed to open ", Filename, 13,10)

   ' now read the data...
   else   
      do       
         dataByte = SD.ReadByte
         Console.Write(dataByte)
      loop Until SD.EOF 
      SD.Close
      Console.Write("Finished", 13, 10) 
   end if   
end sub