View previous topic :: View next topic |
Author |
Message |
boulder
Joined: 15 Mar 2008 Posts: 53
|
spi_write() |
Posted: Thu Dec 11, 2008 6:35 pm |
|
|
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
|
Re: spi_write() |
Posted: Thu Dec 11, 2008 7:12 pm |
|
|
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
|
|
|
boulder
Joined: 15 Mar 2008 Posts: 53
|
|
Posted: Thu Dec 11, 2008 9:47 pm |
|
|
Thanks for help. |
|
|
|