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

SPI - Changing modes with 16 bit data

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



Joined: 14 Dec 2009
Posts: 33
Location: Wales

View user's profile Send private message

SPI - Changing modes with 16 bit data
PostPosted: Tue Jan 05, 2010 10:18 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jan 05, 2010 2:26 pm     Reply with quote

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.
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