CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Spi_Xfer..... and questions

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
joseph20480



Joined: 21 Dec 2011
Posts: 42

View user's profile Send private message

Spi_Xfer..... and questions
PostPosted: Wed Dec 21, 2011 2:32 pm     Reply with quote

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: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Dec 21, 2011 2:39 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Dec 21, 2011 2:40 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Dec 21, 2011 2:44 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Dec 21, 2011 2:48 pm     Reply with quote

What's your CCS compiler version ? It's given at the top of the .LST file.
It's a 4-digit number similar to this:
http://www.ccsinfo.com/devices.php?page=versioninfo
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Wed Dec 21, 2011 4:12 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group