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

MCP7952X/MCP7951X SPI Real-Time Clock Calendar

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



Joined: 25 Oct 2012
Posts: 51

View user's profile Send private message

MCP7952X/MCP7951X SPI Real-Time Clock Calendar
PostPosted: Tue Aug 20, 2013 6:33 am     Reply with quote

Hi all

have someone already use this RTCC ?
is there any driver or source that exist for this ?

thanks in advance
in_nursery



Joined: 25 Oct 2012
Posts: 51

View user's profile Send private message

PostPosted: Tue Aug 27, 2013 8:36 am     Reply with quote

hi all

So I begin to write the drivers for this RTTC.
I can write, read everything work good, but the data aren't stored and the clock seems not to run.
When I read my change, they are always the same no sec, min,.. change, just the value I store.
What I am doing wrong?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Aug 27, 2013 8:55 am     Reply with quote

Posting a very short program (10 lines) would make it a lot easier to help you. Now we have to guess.

Do you make the CS line high again after the databyte has been written? So, the sequence to write to a register should be:
- make CS low
- send WRITE instruction (0x02)
- send address byte
- send data byte
- make CS high again
See figure 10-2 in the data sheet.

When you can read/write the registers but the clock is not running, then most likely you didn't set the ST bit in address 0x01. This bit is used to Start the Oscillator. See for further info the description of register 5-2 in the data sheet.
in_nursery



Joined: 25 Oct 2012
Posts: 51

View user's profile Send private message

PostPosted: Tue Aug 27, 2013 10:26 am     Reply with quote

I find out my problem I erase the ST bit when I write the second.
So it's corrected.
in_nursery



Joined: 25 Oct 2012
Posts: 51

View user's profile Send private message

PostPosted: Tue Aug 27, 2013 11:14 am     Reply with quote

another question
How to only set one bit on Spi Write command?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Aug 27, 2013 1:44 pm     Reply with quote

Using the 'logical or' command '|' you can add bits to an existing value.

Code:
#define ENABLE_ST  0b10000000

spi_write(value | ENABLE_ST);
in_nursery



Joined: 25 Oct 2012
Posts: 51

View user's profile Send private message

PostPosted: Tue Aug 27, 2013 2:05 pm     Reply with quote

Yes, I found it before your reply.
Everything work nice.
Thanks for your help.
PrinceNai



Joined: 31 Oct 2016
Posts: 480
Location: Montenegro

View user's profile Send private message

PostPosted: Mon Oct 17, 2022 3:15 am     Reply with quote

Quote:

With this code I hoped to make the seconds from the RTC visible on the display! But I only keep seeing the zero from the variable 'Data'


Well, we keep seeing zero of your code :-). Post it and someone will sure try to help you.
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