• Pic® Basic


  • SD_File_System

    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

    Code:
          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
          '-----------------------------------------------------------
          Over_Sub:                                                  
              DelayMS 200
          '-----------------------------------------------------------
          Main_Prog:
              HSerOut ["INSERT SD OR MMC",13]
              Repeat
                  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]
                  Stop
     
              EndIf
              HSerOut ["FILE OPEN",13]
              While SD_EOF < 1
                  Response = SD_Read_Byte_From_File
                  HSerOut [Response]
              Wend  
          '-----------------------------------------------------------
          Finish:
              HSerOut [13]
              HSerOut ["FINISHED",13]
              Stop
  • Recent Activity

    teo-16018

    Microsoft security essentials blues

    Thread Starter: shantanu@india

    Hi, A strange thing happened just now.My Windows 7 Micrsoft Sercurity Essentials suddenly gave a warning that prplus.exe(Compiler) is a potential...

    teo Today, 19:23 Go to last post
    pic-ignorant-1162

    Proton Runtime Error

    Thread Starter: Paulcc

    I have proton running well on my laptop, but after installing it on my desktop, I get the following runtime error: "Runtime Error 217 at 000709FC" I...

    pic-ignorant Yesterday, 22:11 Go to last post
    David Barker-251

    UMC bootloader 18F46K22

    Thread Starter: shunt010

    Hi all. I am trying to build a UMC bootloader file for the 18F46K22, and it doesn't appear to work. It returns (in the error log) Error ...

    David Barker Today, 11:20 Go to last post
    barak-1433

    SPI mssp

    Thread Starter: picprotonguy

    Just ordered Digital to Analog IC MCP4822 with SPI interface and immediately opened proton manual. I'm very disappointed, it looks like Proton...

    barak Today, 16:06 Go to last post