View previous topic :: View next topic |
Author |
Message |
exodia505
Joined: 07 Feb 2012 Posts: 34
|
pic18f452 writing in MMC card with spi mode |
Posted: Sat Mar 31, 2012 9:08 am |
|
|
hello guys!!
I have a 18f452 and i would like to know how to use Spi mode to just write 5 adc values in mmc card.
If its possible show me a simple example plz!
Thanks !! _________________ NOway!! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19591
|
|
Posted: Sat Mar 31, 2012 9:27 am |
|
|
The complicated part, is not the software, but the hardware. The 452, is a 5v PIC, which means you need 5v, to 3.3v adapting circuits on the signals from the PIC to the SPI card (this can be done with resistors), 3.3v power supply to feed the card, and (worse), 3.3v logic to 5v logic for the signals the other way.
The code is about 5 minutes work. Open a file, write the values as text with printf, and close the file. The hardware between the two chips is a few _hours_ work.
You need the hardware working first.
Best Wishes |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9272 Location: Greensville,Ontario
|
|
Posted: Sat Mar 31, 2012 9:32 am |
|
|
1) the PIC18F452 does NOT interface directly with any MMC card ! Search this forum for dozens of 'hits' about this subject.
Once you have proper hardware, simply use the example that CCS provides in the examples folder or one of the ones here or in the code library forum.
2) If you have any problems...post compiler version, PIC type,MMC card and how/what the interface between the PIC and MMC card is.
3) failure to NOT properly interface 5 volt PIC to 3 volt MMC card will destroy the MMC card, so reread step #1 !
4) be advised that not all MMC cards conform to any 'standard', as well some drivers may not work with larger cards. |
|
|
exodia505
Joined: 07 Feb 2012 Posts: 34
|
|
Posted: Sat Mar 31, 2012 9:33 am |
|
|
I know that sd card runs with 3.3v.
I just need to write values no read from mmc card.
I think my hardware circuit is set and fine.
May you give me a simple code example plz?
I don't want to write data in blocs of 512 byte. _________________ NOway!!
Last edited by exodia505 on Sat Mar 31, 2012 11:09 am; edited 1 time in total |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1941 Location: Norman, OK
|
|
Posted: Sat Mar 31, 2012 10:51 am |
|
|
OK, so you are not blind, glad to hear it! Folks here took the time to
say this so you could avoid the mistakes made recently by many
others on this board, so your attitude is unwarranted.
Since you are not blind I assume you can SEE the Search button at the
top of the forum page. So, why didn't you search the forum before
asking? There is lots of code already there without asking someone
here to do the work for you. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
|