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

A question regarding RTC - MCP7940N

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



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

A question regarding RTC - MCP7940N
PostPosted: Fri May 01, 2015 1:24 am     Reply with quote

Hi all,
I am using the MCP7940N RTC.


http://www.farnell.com/datasheets/1754398.pdf


I was wondering if there is any way of finding out if the
battery was removed and put back during power off.

Can i set a internal RAM location to some value say 0xAA and then check later on when power is re applied.

OSCON bit does not seem to help here.

Thanks,
Jay.
Ttelmah



Joined: 11 Mar 2010
Posts: 19369

View user's profile Send private message

PostPosted: Fri May 01, 2015 3:19 am     Reply with quote

You don't need to fiddle.

Just read the Power Fail Time Stamp registers (18 to 1B).

If these contain a time, then the battery was OK all the time the chip was off. If they are empty. then the battery has been off, since the last main power failure.

These store the time when the main supply goes off, but their contents are lost if the battery goes off as well.
jaikumar



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

PostPosted: Fri May 01, 2015 3:33 am     Reply with quote

Thanks Ttelmah.

Regards
Ttelmah



Joined: 11 Mar 2010
Posts: 19369

View user's profile Send private message

PostPosted: Fri May 01, 2015 5:01 am     Reply with quote

I happened to want to ensure the chip always had a valid time, and 'force' a reinitialization when the battery had been off. Suddenly 'twigged' I could use these registers. Smile
jaikumar



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

PostPosted: Sat May 02, 2015 12:38 am     Reply with quote

Want to know if i can apply power to RTC using the port pin of 16f887 instead of from regulator.
I know it sounds ridiculous but i have one reason
I read some where in the datasheet or application notes that the applied voltage should drop suddenly and should not droop for the RTC to work properly.
Since i am driving a motor i have a big cap. The controller is protected by a
supervisor. So i want to know if i can drive the RTC from a port pin.

Regards,
Jay.
Ttelmah



Joined: 11 Mar 2010
Posts: 19369

View user's profile Send private message

PostPosted: Sat May 02, 2015 4:47 am     Reply with quote

Probably yes.

However where did you read this?.

If you look at the data sheet, there is a _minimum_ rise time specified, but no 'maximum'. The_PIC_ however has a maximum rise time, to reset properly, which with a large supply capacitor may well cause problems (you need an external MCLR circuit, if the supply takes significant time to rise...).
jaikumar



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

PostPosted: Sat May 02, 2015 6:30 am     Reply with quote

Ttelmah,

Please see below app note:
http://ww1.microchip.com/downloads/en/AppNotes/01365C.pdf

Although this app note is for the MCP794XX, as far as the RTC goes
they function the same.

Page-2 - Power-UP

it also specifies about using the MFC pin. But if i don't want to use it.
Can i just leave the pin open. Its not clear on that.

Regards,
Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19369

View user's profile Send private message

PostPosted: Sat May 02, 2015 1:09 pm     Reply with quote

The bit you are looking at there, is only if the supply droops below the minimum operating Vdd voltage, and then recovers. Seriously if your supply to the PIC does this, you have much bigger problems.....

If you are running the motor from the same supply as the PIC, 'think again'. Separate the rails. Have a PIC supply, with it's own capacitor. This can even be fed from the motor rail, but separated (perhaps an inductor, or resistor), from the actual motor rail. You have to understand that motors, can do some nasty things like acting as a generator, when switched off. This can result in the rail going above it's normal voltage. The energy both from this and the inductive nature of the drive coils, has to go _somewhere_, and you need to design your supply to handle this.
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