SD card does not initialize


Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Aug 2014
    Posts
    1

    Default SD card does not initialize

    i am running a simple code that is supposed to create a txt file on sd card and write a line in it. My code starts from initializing command. i checked the return value. and the card does not initialize. what do i do now??? what can be the possible reasons for this???
    please help.
    Just for information i am using 8gb sd card. if it has anything to do with it. My code now is as follows
    My code is as follows

    i checked the return value. and yes the card does not initialize. what do i do now??? what can be the possible reasons for this???
    please help.
    Just for information i am using 8gb sd card. if it has anything to do with it. My code now is as follows
    My code is as follows

    void delay (unsigned int k)
    for (i=0;i<=k;i++)
    {
    ;
    }
    void main(void)
    {
    FSFILE *MyFile;
    unsigned char txt[ ]="This is a TEXT message";
    TRISB=0;
    //
    // Initialize the SD card routines
    //
    FSInit( );
    if (FSInit()!=TRUE)
    {PORTB=0xFF;
    delay(10000);
    PORTB=0x0;
    delay(10000);
    }
    //
    // Create a new file called MESSAGE.TXT
    //
    MyFile = FSfopenpgm("MESSAGE.TXT", "w+");
    //
    // Write message to the file
    //
    FSfwrite(txt, 1, 22, MyFile);
    // Close the file
    //
    FSfclose(MyFile);
    while(1);
    }

    When i run the code, the portb leds blink. which means the sd card does not initialize.
    Attached Files Attached Files
    Last edited by bushratariq; - 21st August 2014 at 11:27.

Similar Threads

  1. Do you have to initialize an on-Screen Display module?
    By Ramius in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 28th April 2011, 00:53
  2. PortB pins will not initialize LOW, only HIGH?
    By ronbowalker in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th December 2009, 19:27
  3. Replies: 2
    Last Post: - 27th May 2008, 15:49
  4. HOW do you initialize PortC to normal I/O??
    By Len in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th June 2005, 18:56
  5. SD-Card
    By glaubertadeu in forum General
    Replies: 1
    Last Post: - 27th April 2005, 14:57

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts