View previous topic :: View next topic |
Author |
Message |
joseph20480
Joined: 21 Dec 2011 Posts: 42
|
Spi_Xfer..... and questions |
Posted: Wed Dec 21, 2011 2:32 pm |
|
|
Hi,
I try to use a sdcard on my pic with fat16 system file. I use this code... but it's not in reality my problem...
http://www.ccsinfo.com/forum/viewtopic.php?t=46966
This code use spi_Xfer with the PIC 18f4520. ->> Compilation OK
My question is why when try to compile with my pic, a pic 18f4550, it's doesn't work
>>> *** Error 12 "C:\PROGRA~1\PICC\drivers\mmcsd.c" Line 577(15,16): Undefined identifier -- spi_xfer
the compilateur seems to say me , the spi_xfer fonction is not available... but the 18f4520 and 18f4550 is the same family ... No ?
If you have an idea, an explication.... it's very sympathic to answer me |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Wed Dec 21, 2011 2:39 pm |
|
|
The error may be in a line or two above the one you think it is....
without seeing the code it's hard to say..
however...
a bigger problem may exist.
The 18F4550, as well as the 18F4520 are 5 volt devices and the sd card is probably 3.3 volt( most if not 100% are). So do you have the correct level translators between the 2 devices ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Dec 21, 2011 2:40 pm |
|
|
Quote: | the spi_xfer function is not available
|
You must be missing the #use spi() statement. spi_xfer() expects that
library statement to be above main(). (You must put in the full required
parameters for it, of course). |
|
|
joseph20480
Joined: 21 Dec 2011 Posts: 42
|
|
Posted: Wed Dec 21, 2011 2:44 pm |
|
|
Thanks for your rapidly reply...
So, i have try to compile my program with
#include <PIC18F4520.h> instead of <PIC18F4550.h>
>>Result Compilation successful
... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Wed Dec 21, 2011 4:12 pm |
|
|
I'd guess you have an #USE RS232 line.
Problem is that on the 4550, the SPI pins are also used for RS232. SDO, is shared with the RS232 RX. So a #USE SPI, doesn't get accepted, if the pin is in use for RS232....
Best Wishes |
|
|
|