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 support@ccsinfo.com

SPI and I2C on PIC18F8723

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








SPI and I2C on PIC18F8723
PostPosted: Sat Feb 28, 2009 9:05 am     Reply with quote

I want to use a SPI device and a I2C device with a PIC18F8723. I know the chip has 2 MSSP modules that operate independantly from each other. But how do you set that up in CCS? Thanks for your help!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Feb 28, 2009 9:45 am     Reply with quote

Look in the CCS manual, in the section on setup_spi():
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
You will see the functions that allow setting up each SPI module.
Look in the sections on spi_read() and spi_write() for similar functions.
Guest








PostPosted: Sat Feb 28, 2009 9:53 am     Reply with quote

I understand how to setup SPI and read and write. But when you want to use SPI and I2C one mssp module needs to do the SPI and the other mssp module has to do the I2C. In CCS do you just setup the spi and I2c as if you were using them as the only device or do you have to do something special in CCS to setup both MSSP modules?
Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Feb 28, 2009 9:59 am     Reply with quote

You can select one of the two modules for SPI. If you choose the first
module for SPI, then use setup_spi() to configure it. If you select
the 2nd module for SPI, then use setup_spi2().

The remaining module can be setup for hardware i2c with a #use i2c()
statement. Just specify the pins that are associated with the module for
the sda= and scl= parameters in the #use i2c() statement. Also, put in
the FORCE_HW parameter.
Guest








PostPosted: Sat Feb 28, 2009 10:08 am     Reply with quote

OK thats excatly what I was looking for. Ill give it a try and post later next week. Thanks alot!! Very Happy
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