This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Writing files with 8051

Hello,

I would like some assistance with storing information on a SD card in the format of a text file. This SD card is connected to a 8051 microcontroller. Communication with the card is done via the SPI. I'd really appreciate some sort of #include file or anything that lets me have access to functions such as fprintf and fscanf, fopen, fclose. Also if anyone can tell me weather FATfs (elm-chan.org/.../00index_e.html) files are ok to compile on a 8051.

Parents
  • "you cn get directly addressable 2Mbyte flash chips for <$3"

    Depends on the actual volume of data involved - you'd probably have to look quite hard to find an SD card smaller than 2Gbyte these days!

    "no FAT, no ..., no ..."

    That's not exactly true, is it?

    You will have to devise some scheme for erasing the flash, determining what space is free, wear levelling, etc, ...

    You will also have to devise some scheme to get the data off the embedded device and onto the PC.

Reply
  • "you cn get directly addressable 2Mbyte flash chips for <$3"

    Depends on the actual volume of data involved - you'd probably have to look quite hard to find an SD card smaller than 2Gbyte these days!

    "no FAT, no ..., no ..."

    That's not exactly true, is it?

    You will have to devise some scheme for erasing the flash, determining what space is free, wear levelling, etc, ...

    You will also have to devise some scheme to get the data off the embedded device and onto the PC.

Children
  • For wear-leveling, it's possible to use a 2MB memory as a single ring-buffer where the writes not only contains the measurements + time stamps but also (if the time stamps aren't strictly increasing) record sequence numbers that allows the program to know where the current position is for read and write.

  • For wear-leveling, it's possible to use a 2MB memory as a single ring-buffer where the writes not only contains the measurements + time stamps but also (if the time stamps aren't strictly increasing) record sequence numbers that allows the program to know where the current position is for read and write

    struct
    {
    whatever else
    used
    }
    


    set 'used' to zero when the place is used (it will be 0xff after erase)
    at power up transfer first empty to ram

    Erik

  • struct
    {
    whatever else
    used
    read
    }
    

    if you have no other means of determining which records have been transferred to the PC, expand as the above

    Erik