SD Card Memory Address Location using mmcsd.c PLEASE HELP!

Discussion in 'The Projects Forum' started by curiousaboutcircuits, Apr 17, 2010.

  1. curiousaboutcircuits

    Thread Starter New Member

    Mar 3, 2010
    Hi Everyone,

    I've been successful in modifying ex_mmcsd.c file in CCSC Compiler to write data to memory location 0x1000 and 0x1001 and displaying it on a 16x2 LCD display.

    My goal is to set aside each block (512bytes) for logging data (body weight) for individuals (ID). I know I have no choice but to set aside block size to be 512 bytes even though I only need to use about 16bytes to keep track of individuals' info.

    I've been having trouble trying to figure out how memory addressing works in SD. I've looked at the manual and everything, but I am not sure how to partition each block as in I don't know when one block starts and ends and etc. MikroC compiler has a command where you can write to each sector by just naming a sector by a number; for example mmmc_write_sector(10, data). In MMCSD.C , you can write to a block, but it appears that you have to have a specific address such as 0x1000, which means if that is where the block starts, all 512bytes after 0x1000 constitutes that one block.

    My problem is that I don't know where blocks start. Anybody have any suggestions? Thanks

    Also, I am using PIC18LF4520 and a 2GB SanDisk SD Card