View previous topic :: View next topic |
Author |
Message |
groston
Joined: 06 Mar 2007 Posts: 6
|
Bug in spi_read()? |
Posted: Wed May 30, 2007 9:32 pm |
|
|
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
|
|
Posted: Wed May 30, 2007 9:43 pm |
|
|
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
|
|
Posted: Wed May 30, 2007 10:17 pm |
|
|
Ah - quality documentation. One page says 'X" another says "not X". Quality goes in before the names goes on... _________________ Gerald P. Roston |
|
|
|