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
Posted: Sat Feb 28, 2009 9:45 am
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
Posted: Sat Feb 28, 2009 9:53 am
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
Posted: Sat Feb 28, 2009 9:59 am
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
Posted: Sat Feb 28, 2009 10:08 am
OK thats excatly what I was looking for. Ill give it a try and post later next week. Thanks alot!!
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