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

help needed on spi master and slave c code

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



Joined: 25 Aug 2009
Posts: 3

View user's profile Send private message

help needed on spi master and slave c code
PostPosted: Sat Dec 19, 2009 10:20 pm     Reply with quote

Hi all, I'm doing SPI on a project and I'm new to spi. How do i assign the register sspcon1 and sspstat?

Is it this (at declaration):
Code:

#define sspcon1
#define sspcon2
#define sspstat


Or this (at declaration):
Code:
# byte sspcon1 = 0x20
# byte sspstat = 0x00


Or this (in main code):
Code:
sspcon1 = 0x20;
sspstat = 0x00


Or other method? I tried the first and second declarations above but my code didn't work. I tried the third declaration but compiler said "the line has no effect". What should I do? I just want to perform the most basic spi of master send data to slave using PIC16F877A for both. Pls help.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Dec 19, 2009 10:46 pm     Reply with quote

Do you have the CCS compiler ? The following links show how to
write SPI code if you have the CCS compiler:

Here is a simple test program to show some activity on the SPI master's
clock and data pins:
http://www.ccsinfo.com/forum/viewtopic.php?t=40998&start=4

Example of an SPI master program:
http://www.ccsinfo.com/forum/viewtopic.php?t=41008&start=5

Here are some sample SPI master and slave programs:
http://www.ccsinfo.com/forum/viewtopic.php?t=39145
http://www.ccsinfo.com/forum/viewtopic.php?t=26888
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