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

Bug in spi_read()?

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



Joined: 06 Mar 2007
Posts: 6

View user's profile Send private message Visit poster's website

Bug in spi_read()?
PostPosted: Wed May 30, 2007 9:32 pm     Reply with quote

I am using the CCS C compiler, version PCM 4.x. The system uses a PIC 16F886 as an SPI master and another device as the SPI slave. The PIC is being configured as:

setup_spi(SPI_MASTER | SPI_L_TO_H | SPI_CLK_DIV_16);

According to the documentation, page 51, "If you just want to clock in data then you can use spi_read() without a parameter."

This just isn't so. I have an oscope hooked up to my test system, and when spi_read() is called without a parameter, the clock is not generated.

Is there a fuse, or some other parameter, that needs to be set, or is this a bug?
_________________
Gerald P. Roston
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 30, 2007 9:43 pm     Reply with quote

The CCS manual says this in the SPI_READ() section:
Quote:

If there is no data to send just do a SPI_READ(0) to get the clock.


To read from the slave, this is what the master should do:
Code:

int8 c;

c = spi_read(0);
groston



Joined: 06 Mar 2007
Posts: 6

View user's profile Send private message Visit poster's website

PostPosted: Wed May 30, 2007 10:17 pm     Reply with quote

Ah - quality documentation. One page says 'X" another says "not X". Quality goes in before the names goes on...
_________________
Gerald P. Roston
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