Sonsivri

Electronics => Pic C Languages => Topic started by: fagari on November 20, 2007, 10:24:43 22:24



Title: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: fagari on November 20, 2007, 10:24:43 22:24
Here is my SD MMC Card Fat16 Example project.

It is very good Example for SD MMC Card.
 
Demo Read CONTURY.TXT in SD CARD and Send RS232 port.

Sorce code and Proteus file  Link:

http://rapidshare.com/files/71131573/SD_MMC.rar


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: ysy on November 21, 2007, 03:58:47 03:58
I dont like ccs, its buggy. microchip produce pic12 pic16 pic18 pic24 pic33, their  c
 compilers are different, features in c18 and c30 and c32 are also different. i think  developers using them are hard to learning these products and tools.


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: bxac on November 21, 2007, 02:51:10 14:51
Proteus has model for MMC. Is this going to work if I want the final design with SD?


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: aj49m on November 22, 2007, 02:32:14 14:32
in theory, mmc and sd are same



Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: endSly on November 25, 2007, 02:04:46 14:04
MMC and SD are no identical. SD is a little more fat


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: incubus22 on November 27, 2007, 04:42:54 04:42
Here is my SD MMC Card Fat16 Example project.

It is very good Example for SD MMC Card.
 
Demo Read CONTURY.TXT in SD CARD and Send RS232 port.

Sorce code and Proteus file  Link:

http://rapidshare.com/files/71131573/SD_MMC.rar


Hello fagari!  :)

How did you make the image file (COUNTRY.TXT) into a Proteus MMC image (cardimage.mmc)? What program did you use? Please teach me how. Can I convert any text file into this image (cardimage.mmc)?

How about the reverse? I mean, when I want to convert the cardimage.mmc to a text file. Is this possible?


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: sslobodyan on November 27, 2007, 11:13:32 11:13
With WinHex you can read some sectors from your floppy or hard disk. I just save file to clean floppy and save some sectors from floppy to cardimage.mmc. Floppy has FAT16, hard disk FAT32.


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: incubus22 on November 27, 2007, 01:57:33 13:57
With WinHex you can read some sectors from your floppy or hard disk. I just save file to clean floppy and save some sectors from floppy to cardimage.mmc. Floppy has FAT16, hard disk FAT32.

Thanks for replying!  :)

Can I convert a certain file in my hard disk(for example sample.txt) into cardimage.mmc? How do I do this? There are many convert options in WinHex. Which one should I choose? Please teach me how. It's my first time to use WinHex.

Also, after manipulating the cardimage.mmc in Proteus using a PIC18F(with FAT32 implementation), can I bring it back to the text file format which can be understood by Windows? I am confused with this because I can't understand the data whenever I open cardimage.mmc with Wordpad or Winhex.












Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: fagari on November 27, 2007, 02:06:24 14:06
Hello incubus22

I use 32 MB SD Card and copy CONTRY.TXT in SD Card.
after make image file with WinHex.

if you don't have sd Card.

You can use 'USB Flash Disk Example' in the Protus 7.2



Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: incubus22 on November 27, 2007, 06:55:49 18:55
Hello incubus22

I use 32 MB SD Card and copy CONTRY.TXT in SD Card.
after make image file with WinHex.

if you don't have sd Card.

You can use 'USB Flash Disk Example' in the Protus 7.2



Thank you very much fagari!  :) I'll try it.


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: aj49m on November 27, 2007, 08:27:54 20:27
MMC and SD are no identical. SD is a little more fat

i refered me to protocolo, case SPI


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: Marineland on November 29, 2007, 09:09:05 09:09
Hi fagari,

Here's a difference between both SD Image file, I explain:
You file (cardimage.mmc) is a FAT16 and the file (disk.bin) from Proteus sample is a FAT12.
Thus, if i try to use your file (cardimage.mmc) in the simulation, windows don't create a virtual "PROTEUS USB" mass storage... (btw: there's not source to change in FAT16 in Proteus sample directory).
I've not yet find another "Virtual USB Mass Storage" on the web! :(
If you or anybody have a answer, it's welcom... :)

Regards,
Marineland


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: fagari on November 29, 2007, 06:26:57 18:26
Hi Marineland

1. Copy 'cardimage.mmc'(in my project) file to 'Proteus 7 Professional\SAMPLES\VSM for USB\PICDEM FS USB\MSD' directory.

2. Open picdem 'fs usb.dsn' file with Proteus.

3. Right click on the MMC and select 'Edit Properties'.

4. Change Size of Media(MB) to 32 and Card Image File to 'cardimage.mmc' and press Ok.

5. Run simulation and plug usb connector.

6. You must see new removeble drive in my computer.


File read ok. but write and format have problem.

Posted on: November 29, 2007, 07:19:54 19:19 - Automerged

Hi Marineland again

Proteus sample file imformation :

The USB firmware used in this sample is freely available from the Microchip
Technologies website (Application Note  AN1003) and has not been modified.

AN1003 application support FAT16, FAT32 or NTFS file system.








Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: Marineland on November 30, 2007, 11:08:12 11:08
Hi Fagari,

Thanks for the response...  :)
I'v followed yours instructions but the simulation failed:
This's the error: "Can't ceate or open card image file: cardimage.mmc"

What i'm doing wrong?  ???

Regards,
Marineland


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: fagari on November 30, 2007, 10:05:56 22:05
Hi Marineland,

My MSD Project is here.

http://rapidshare.com/files/73423843/MSD.rar

Try this.

if your problem going on, try reinstall proteus.

Good luck.



Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: Marineland on December 01, 2007, 02:27:14 14:27
Hi, Fagari,

I've tried your project and It's works fine... :D
Thanks again...

Regards,
Marineland


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: mikepic on December 05, 2007, 03:13:04 15:13
Hi,

I'll try your project, because some time ago I tried to make a project with SD card and CCS libraries, but it didn't work at all

Thanks


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: kev on December 23, 2007, 11:29:54 11:29
Thanks for the info, I'll try your project as soon as I am allowed to se the links !


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: xzb on December 28, 2007, 02:04:13 02:04
Thanks fagari! I can pat use !


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: Trump on December 28, 2007, 08:28:41 20:28
Hm.... The driver work, but I have some problem in open files in the root, only the first file open. Files in other folder are OK. And how I close a file?


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: sevesa on March 14, 2008, 11:24:49 23:24
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en532040

Memory Disk Drive File System Library



Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: xzb on May 13, 2008, 09:13:47 09:13
I use this Project proteus OK,but a true  PIC18F252 failing.
why?
   SD 128M

see following data.

**** SD / MMC FAT16  Read Demo for Sonsivri ****                                               
Now Open File on SD Card                       

cmd0   

 cmd=40       
 FF 01     
 cmd=41       
 FF 01 FF FF FF FF FF FF FF FF FF FF FF FF                                         
F FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF                                                                               
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F                                                       
 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F                                                                               
F FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF                                                               
cmd1   

 cmd=41       
 FF 00     
 cmd=50       
 FF 00     
 cmd=51       
 FF 00     
 read block address=0                     

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00        //proteus display:  sector0=EB 3C 90 4D 53 44 4F 53 35 2E 30 00 02 04 04 00 02 00 02 00 00 F8 F2 00 3F 00 FF 00 61 00 00 00                 
 cmd=51       
 FF 00     
 read block addr =32              

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
 00 00 00 00 00 00 00 00                  
 cmd=   
 FF 00     
 read block address=64                     

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=96                     

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=128                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=160                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=192                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=224                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51     
 FF 00     
 read block address=256                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=288                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=320                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51     
 FF 00     
 read block address=352                       

**** SD / MMC FAT16  Read Demo for Sonsivri ****                                               
Now Open File on SD Card                       

cmd0   

 cmd=40       
 FF 01     
 cmd=41       
 FF 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F                                                                               
F FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF                                                                               
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF                                                                               
 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F                                                                               
F FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF                                                           
cmd1   

 cmd=41       
 FF 00     
 cmd=50       
 FF 00     
 cmd=51       
 FF 00     
 read block address=0                     

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=32                     

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 0                   
 cmd=51       
 FF 00     
 read block address=64                     

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0                                                                             
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=96                     

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=128                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=160                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=192                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=224                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=256                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                             
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=288                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=320                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=352                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                             
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=384                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=416                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 00 03                       
 cmd=51       
 FF 00     
 read block address=448                       

 read block tries for FE =2                           

 sector0=02 00 06 07 E0 C9 61 00 00 00 9F C9 03 00 00 00 00 00 00 00 00 00 00 00                                                                             
 00 00 00 00 00 00 00 00                       
 cmd=51       
 FF 00     
 read block address=480                       

 read block tries for FE =2                           

 sector0=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                               
 00 00 00 00 00 00 55 AA                       
 cmd=51       
 FF 00     
 read block address=512


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: fr5cu on May 14, 2008, 02:24:41 14:24
can you read an other type of card?


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: MCan on June 02, 2008, 04:53:07 04:53
when i compile your code, compiler show a message box (i/o error 103)



Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: xzb on June 02, 2008, 07:07:44 07:07
hi kireytir
you delete except source .c and .h fiile,afresh the compiler ok!


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: eeyrw on July 23, 2008, 05:41:30 17:41
How to edit the file in the Image?Using winhex??


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: manish12 on January 30, 2009, 09:20:31 09:20
i am getting same i/o error 103 .

what is the sol of this error ?


Title: Re: SD MMC Card Fat16 Demo in CCS C and Proteus Design File
Post by: xzb on March 02, 2009, 03:05:28 03:05
the data saved in MMC is very important, so I want to locked MMC. That means one who dosen't have password can not to access data on the card.I just know to use CMD42, but I can not understand CMD42's command data block.I use mcc18 SPI mode. Can you help. Thanks!


Title: Problem using HDD Driver
Post by: vegekou on November 30, 2011, 11:30:44 11:30
hello can you tell me how to use file_write(int8 fnbr int *buffer)
to write some opened file.When I use it first time it write but I could'nt read next time. Help it is hotting now.