• Pic® Basic

  • SD_File_System


    The SD_File_System module is a macro library for use with Library Manager by JohnGB. This module has been written by Steven Wright (swright on PDS forum). The library module is offered on an as-is basis with no warranty as to its effectiveness, operation or reliability. Users use it at their own risk.

    Feature summary
    • Macros for accessing Secure Digital (SD) or Multimedia Memory Card (MMC) cards – SD_Init, SD_Sector, SD_Read and SD_Write.
    • Macros for writing files to these cards in the FAT16 format – such files can be read directly by a PC, using a card reader. The commands include SD_Init_FS, SD_Check_For_File, SD_New_File, SD_Append_File, SD_Write_Byte_To_File, SD_Write_String_To_File, SD_Save_File and SD_Close_File. Also commands for reading files, including SD_Open_File and SD_Read_Byte_From_File. Also file and disk management commands, including SD_Delete_File, SD_Free_Space, SD_Disk_Size, SD_Dir and SD_Psuedo_Format.

    Download module
    Download: SD_File_System

    Example 1

          Device = 18F4550
          XTAL = 20
          ALL_DIGITAL = TRUE
          HSERIAL_BAUD = 115200                                       'Setup RS232 port
          HSERIAL_RCSTA = 010000                                        
          HSERIAL_TXSTA = 100100
          Dim Response As Byte
          Dim SD_IO As Byte
          Symbol SD_CS = PORTD.2                                      'SPI CS to SD CS (SD pin 1)
          Symbol SD_DI = PORTD.5                                      'SPI DO to SD DI (SD Pin 2)
          Symbol SD_CLK = PORTD.3                                     'SPI CLK to SD CLK (SD Pin 5)
          Symbol SD_DO = PORTD.4                                      'SPI DI to SD DO (SD Pin 7)
          Include "SD_MMC_Read_File_Lib.pbp"                          'Include managed library file
          GoTo Over_Sub                                               'Jump over the subroutines
              DelayMS 200
              HSerOut ["INSERT SD OR MMC",13]
                  Response = SD_Init_FS
              Until Response = 0
              HSerOut ["OPENING FILE",13]
              SD_File_Name = "TEST001"                                'File Name, upper case only!
              SD_File_Ext = "TXT"                                     'File Ext, upper case only!  
              Response = SD_Open_File
              If Response = 1 Then
                  HSerOut ["FILE NOT FOUND",13]
              HSerOut ["FILE OPEN",13]
              While SD_EOF < 1
                  Response = SD_Read_Byte_From_File
                  HSerOut [Response]
              HSerOut [13]
              HSerOut ["FINISHED",13]
  • Recent Activity


    Hx711 calibration

    Thread Starter: amod

    Iam using load cell amplifier HX711 module.I have got raw values from module but iam not able to calibrate with load cell.I want make a universal...

    amod Yesterday, 15:23 Go to last post


    Thread Starter: Oldhack

    HELLO The 16F720 is driving me nuts, I had SOIC version and could not get them to run at all so I bought a couple of Dips (all from Digikey) and...

    Oldhack Yesterday, 16:00 Go to last post
    John Drew-26

    About Define directive...

    Thread Starter: SELCUK

    Hi Les, Thank you for new version of Proton Plus. For both Compiler version and If I define $DEFINE FF $0C ;// Form...

    John Drew Today, 02:10 Go to last post

    Fault in bit wise comparisons on release

    Thread Starter: kbaykar

    Hi Les, I just downloaded the release today and seeing that it supports 18F47K40. I am trying to port my code from 18F4685 to 18F47K40. ...

    hadv215 Yesterday, 16:27 Go to last post