Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

changing polarity off the sclk spi bus at runtime

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
Tiny

Bascom Member



Joined: 10 Nov 2010
Posts: 101
Location: The Netherlands

netherlands.gif
PostPosted: Mon Nov 24, 2014 8:33 pm    Post subject: changing polarity off the sclk spi bus at runtime Reply with quote

Hello,

i want to communicate with a MS5541C spi pressure senser.

but there for i need to change the polarity off the SCLK after sending 16 bits to read back the data.

how can i do that?

Regards Tiny

(BASCOM-AVR version : 2.0.7.7 )
Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Mon Nov 24, 2014 10:16 pm    Post subject: Reply with quote

If it's an XMega, do a re-Config, if it's for example an ATMega32, the bit CPOL in SPCR is responsible for clock polarity, depending on the sensors data sheet, you need to check CPHA too.
Back to top
View user's profile
Tiny

Bascom Member



Joined: 10 Nov 2010
Posts: 101
Location: The Netherlands

netherlands.gif
PostPosted: Mon Nov 24, 2014 10:35 pm    Post subject: Reply with quote

sorry i forgot to tell which chip it was, it is a atmega644a
Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Mon Nov 24, 2014 11:14 pm    Post subject: Reply with quote

Tiny wrote:
sorry i forgot to tell which chip it was, it is a atmega644a

Also the ATMega644A has a datasheet and the registers and config-bits even have the same name. Wink
Back to top
View user's profile
Tiny

Bascom Member



Joined: 10 Nov 2010
Posts: 101
Location: The Netherlands

netherlands.gif
PostPosted: Tue Nov 25, 2014 6:39 am    Post subject: Reply with quote

Thank you, i found it
Back to top
View user's profile Visit poster's website
Tiny

Bascom Member



Joined: 10 Nov 2010
Posts: 101
Location: The Netherlands

netherlands.gif
PostPosted: Tue Nov 25, 2014 6:40 am    Post subject: Reply with quote

Thank you, i found it
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
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
You cannot attach files in this forum
You cannot download files in this forum