ac34856
Joined: 14 Dec 2009 Posts: 33 Location: Wales
|
SPI - Changing modes with 16 bit data |
Posted: Tue Jan 05, 2010 10:18 am |
|
|
Can anyone explain how to use SPI modes 0, 1, 2 and 3 when using 16 bit data transfers ?
In other words when using #use SPI directive and spi_xfer is it possible to use different modes in the same way as when using spi_read and spi_write ? |
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 05, 2010 2:26 pm |
|
|
You can specify a stream with the #use spi() statement. Therefore, you
can have multiple #use spi() statements, each with a different stream
name, and with different parameters, including the SPI mode.
However, I believe we've told you before, that #use spi() is more buggy
than the older setup_spi(), spi_read() and spi_write() method. It depends
upon the PIC and the compiler version. We (the people on this forum)
don't have a list of bugs for #use spi(). If you use it, you need to be
able to look at the .LST file and check for possible bugs in the ASM code.
My suggestion: Use setup_spi() (which uses the hardware SPI module)
and just do two sequential calls to spi_write() and spi_read() if you need
to do 16-bit operations. It works perfectly well.
Also, if you have questions, always post your PIC and your compiler
version. And please do not start a new thread for every question on
#use spi(). Add new questions to this thread. |
|