Hello Guys,
i am new with sd cards and i have read almost all posts about them and seriously only you are talking about FAT32 format and have the files.Can anyone guide me?? I am not asking to get free code or something im just stuck here![]()
. I have tried just to initialize the card but i failed. Iam using 18F26K22 hardware SSP1 module for communicating with the card and hardware EUART to debug the programm. I dont want to use the SD_WE and SD_CD and i simply didn't connect them.
Here is what i tried so far but the programm is stucked at "Gosub FSinit" command.
and my SDFSHC32D.bas file is attached.Code:'------------------------------------------------------------------------------- 'DEFINES DEFINES DEFINES DEFINES DEFINES DEFINES DEFINES DEFINES DEFINES '------------------------------------------------------------------------------- include "modedefs.bas" include "fuses_18f26k22.bas" include "eusart_defines_ep7.bas" DEFINE OSC 32 '------------------------------------------------------------------------------- 'VARIABLES VARIABLES VARIABLES VARIABLES VARIABLES VARIABLES VARIABLES '------------------------------------------------------------------------------- i var byte ' COUNTERS COUNTERS COUNTERS COUNTERS COUNTERS COUNTERS COUNTERS COUNTERS '------------------------------------------------------------------------------- ' FLAGS FLAGS FLAGS FLAGS FLAGS FLAGS FLAGS FLAGS FLAGS FLAGS FLAGS '------------------------------------------------------------------------------- ' ARRAYS ARRAYS ARRAYS ARRAYS ARRAYS ARRAYS ARRAYS ARRAYS ARRAYS ARRAY '------------------------------------------------------------------------------- ' PORTS PORTS PORTS PORTS PORTS PORTS PORTS PORTS PORTS PORTS PORTS '------------------------------------------------------------------------------- ' REGISTERS REGISTERS REGISTERS REGISTERS REGISTERS REGISTERS REGISTERS '------------------------------------------------------------------------------- TRISA= %00000000 TRISB= %00000011 TRISC= %00010000 ANSELA=0 ANSELB=0 ANSELC=0 include "SDFSHC32original.bas" SDC_UseHardSPI = TRUE goto Init '------------------------------------------------------------------------------- 'ISR ISR ISR ISR ISR ISR ISR ISR ISR ISR ISR ISR ISR '------------------------------------------------------------------------------- '------------------------------------------------------------------------------- ' Initialization Initialization Initialization Initialization '------------------------------------------------------------------------------- Init: PORTB= 0 PORTA= 0 PORTC= 0 FAT_FileName[0] = "N" FAT_FileName[1] = "A" FAT_FileName[2] = "M" FAT_FileName[3] = "E" FAT_FileName[4] = "S" FAT_FileName[5] = " " FAT_FileName[6] = " " FAT_FileName[7] = " " FAT_FileName[8] = "T" FAT_FileName[9] = "X" FAT_FileName[10]= "T" Hserout ["Init routine: OK!",13,10] for i=0 to 10 Hserout [fat_filename[i]] next i Hserout [13,10] i= 0 PAUSE 100 '------------------------------------------------------------------------------- ' Main Programm Main Programm Main Programm Main Programm Main Programm '------------------------------------------------------------------------------- Main: Hserout ["LoopCount= ",dec i," FAT_error= ",dec fat_error," SDC_status= ",_ dec SDC_status," SDC_response= ",dec SDC_response,13,10] Gosub FSInit pause 10 Gosub FSInit i= i+1 goto Main '------------------------------------------------------------------------------- 'Subroutines Subroutines Subroutines Subroutines Subroutines Subroutines '------------------------------------------------------------------------------- end
SDFSHC32Original.bas
Im looking forward for an answer, Kostas.




Bookmarks