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 CCS Technical Support

help in spi function

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



Joined: 18 Aug 2013
Posts: 2

View user's profile Send private message

help in spi function
PostPosted: Sun Aug 18, 2013 11:26 pm     Reply with quote

Hi every one

I want flip the initial spi clock state to be hi instead of low, i declare the spi function as follow
Code:
#USE SPI (MASTER, SPI1, CLOCK_HIGH=1, CLOCK_LOW=1, MODE=0, BITS=8, LOAD_ACTIVE=1, STREAM=SPI_1, MSB_FIRST)


Thanks for your help
Ttelmah



Joined: 11 Mar 2010
Posts: 19559

View user's profile Send private message

PostPosted: Mon Aug 19, 2013 12:43 am     Reply with quote

The mode number specifies the 'idle' (initial) state. Mode0, idles low. Modes 2 and 3 idle high.
Code:

USE SPI (MASTER, SPI1, MODE=3, BITS=8, LOAD_ACTIVE=1, STREAM=SPI_1, MSB_FIRST)

Have a look at:
<http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus>

Look at 'CPOL' (clock polarity), and the effect of the mode numbers on this.

Best Wishes
zero2004



Joined: 18 Aug 2013
Posts: 2

View user's profile Send private message

PostPosted: Tue Aug 20, 2013 12:50 am     Reply with quote

Thanks
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