This program was the result of a recent issue a digital-diy.com member had regarding SD Cards. It also provides a means to benchmark the speeds of different cards and software configurations. Please ensure you are using the latest version of SDFileSystem.bas (at time of writing: 4.1.4). If you are updating (or do not have the library), then ensure to remove the old "C:\ProgramData\Mecanique\Swordfish\Library\SDMMC" files (if you haven't already).
The program code is heavily based on a benchmark program written by Steven Wright, and end results will still be comparable with those found in the SF Help file and elsewhere online.
The benchmark program runs through a series of tests on a SD or MMC Memory Card. In short form it:
Here's an output display of the programming running (using the PICKit 2 UART Tool)

{ SDMMC Benchmark v1.0 Author: Graham Mitchell Contact: digital-diy.com (search "Swordfish Program - SD/MMC Benchmark") } // device and clock... Device = 18F2620 Clock = 20 #option SD_SPI = MSSP #option SD_SPI_SPEED = spiOscDiv4 '#option SD_SPI_SPEED = spiOscDiv16 '#option SD_SPI_SPEED = spiOscDiv64 '#option SD_SPI = SW // import SD file system, usart and conversion modules... Include "USART.bas" Include "SDFileSystem.bas" Include "Convert.bas" Const ClockDiv = _clock * 1000000 Dim Timer As TMR1L.AsWord // Alias to Timer1 Dim TimerOn As T1CON.Booleans(0) // Start and stop Dim TimerInterruptsEnabled As PIE1.Booleans(0) // Enable interrupts Dim Counter As LongWord Dim CounterUpper As Counter.Word1 Dim Index1, Index2 As LongWord Dim ReadByte As Byte // Timer interrupt handler - every time Timer1 overflows, we // need to increment the upper word of our big 32 bit counter... Interrupt OnTimer() Inc(CounterUpper) PIR1.0 = 0 End Interrupt // start timer... Sub TimerStart() Timer = 0 // Clear timer one CounterUpper = 0 // Clear upper count value TimerOn = True // Start timer End Sub // stop timer... Sub TimerStop() TimerOn = False // Timer off Counter.Word0 = Timer // Save whats left in timer one End Sub // display time Sub DisplayTime() Dim Time As Float Time = 4* Counter / ClockDiv USART.Write("Time Taken: ", FloatToStr(Time,4,3), " sec", 13, 10) End Sub // main program... SetBaudrate(br19200) USART.ReadTerminator = #13 DelayMS(1000) TimerInterruptsEnabled = True // Enable timer interrupts Enable(OnTimer) // Assign the interrupt handler // initialise card... Start: USART.Write("_____________________________________",13,10) USART.Write("digital-diy.com SD/MMC Benchmark v1.0",13,10) USART.Write("Initialise... ") ReadByte = SD.Init If ReadByte <> errOK Then USART.Write("Init Failed ", DecToStr(ReadByte), 13, 10) GoTo ForceEnd Else USART.Write("Init OK", 13, 10) EndIf // quick format... USART.Write("Formatting... ") If Not SD.QuickFormat() Then USART.Write("QuickFormat Failed", 13, 10) GoTo ForceEnd Else USART.Write("QuickFormat OK", 13, 10) EndIf // create a folder... USART.Write("Creating folder... ") If SD.MkDir("FOLDER") <> errOK Then USART.Write("MkDir Failed", 13, 10) GoTo ForceEnd Else USART.Write("MkDir OK", 13, 10) EndIf // change to folder... USART.Write("Entering folder... ") If Not SD.ChDir("FOLDER") Then USART.Write("ChDir Failed", 13, 10) GoTo ForceEnd Else USART.Write("ChDir OK", 13, 10) EndIf // create new file... USART.Write("Creating new file... ") If SD.NewFile("Testfile.txt") <> errOK Then USART.Write("NewFile Failed", 13, 10) GoTo ForceEnd Else USART.Write("NewFile OK", 13, 10) EndIf // start timer, write to file, then stop timer... USART.Write("Writing 1MB file... ") TimerStart() For Index1 = 1 To 1024 For Index2 = 1 To 1024 SD.Write(33) Next Next TimerStop() SD.CloseFile // check for errors... If SD.RWError Then USART.Write("Write Failed", 13, 10) GoTo ForceEnd Else USART.Write("Write OK", 13, 10) DisplayTime() EndIf // open file for reading... USART.Write("Opening file... ") If SD.OpenFile("Testfile.txt") <> errOK Then USART.Write("OpenFile Failed", 13, 10) GoTo ForceEnd Else USART.Write("OpenFile OK", 13, 10) EndIf // start timer, read data, then stop timer... USART.Write("Reading 1MB file... ") TimerStart() Repeat SD.Read(ReadByte) If ReadByte <> 33 Then USART.Write("Read Error", 13, 10) EndIf Until SD.EOF TimerStop() // close the file... SD.CloseFile If SD.RWError Then USART.Write("Read Failed", 13, 10) GoTo ForceEnd Else USART.Write("Read OK", 13, 10) DisplayTime() EndIf ForceEnd: USART.Write("**************** EOT ****************",13,10) USART.Write(" Hit ENTER to repeat",13,10) If USART.Overrun Then USART.ClearOverrun EndIf Repeat Until USART.ReadByte = 13 GoTo Start