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_write()

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



Joined: 15 Mar 2008
Posts: 53

View user's profile Send private message

spi_write()
PostPosted: Thu Dec 11, 2008 6:35 pm     Reply with quote

Hi,
Is it true that SPI slave cannot use spi_write(data) to send out data? Or only master can use spi_write(data) to send out data? On the CCS compiler manual, it says spi_write() can cause clock to be generated. So, I guess it's only used by master.

Thanks.
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: spi_write()
PostPosted: Thu Dec 11, 2008 7:12 pm     Reply with quote

boulder wrote:
Hi,
Is it true that SPI slave cannot use spi_write(data) to send out data? Or only master can use spi_write(data) to send out data? On the CCS compiler manual, it says spi_write() can cause clock to be generated. So, I guess it's only used by master.
Thanks.

For an SPI slave, all you really want to do is put a byte into the SSPBUF register. So if you are worried about what else there may be in spi_write(), just bypass the CCS library and use:
Code:

#byte SSPBUF=0x13   (or whatever it is on your PIC)
  . . .
  SSPBUF = val;

_________________
Robert Scott
Real-Time Specialties
Embedded Systems Consulting
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 11, 2008 7:36 pm     Reply with quote

See this post for detailed info:
http://www.ccsinfo.com/forum/viewtopic.php?t=35442&start=4
boulder



Joined: 15 Mar 2008
Posts: 53

View user's profile Send private message

PostPosted: Thu Dec 11, 2008 9:47 pm     Reply with quote

Thanks for help.
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