Reply to post

Helpful ReplyHot!RTC MCP7940N calibration

Author
amtech
Starting Member
  • Total Posts : 34
  • Reward points : 0
  • Joined: 2014/08/12 22:37:56
  • Location: 0
  • Status: offline
2018/11/01 23:22:30 (permalink)
0

RTC MCP7940N calibration

Hi,
I getting trouble in RTC time. My RTC is daily routine  2 to 4 second lost(Lagging) with reference clock. My RTC part is MCP7940N.So i calibrate this time but i facing the problem with calibration.
 My calibration is 24 hrs monitoring and 6 second lagging. After the calibration of this my RTC gained(Leading) the 2 to 3 second.
this is my codding...
 I used the equation given in data sheet. I cant find what i am doing wrong....
ppm = data;  // this data is lost the second in 24 hrs.
ppm = ppm * 5.7870370;       // 1000000 / 172800.0 --- 172800.0 Sec = 48 Hrs
ppm = (ppm * 0.98304);       // 32768*60/1000000*2 = 0.98304
variable.rtc_present_data[8] = ppm + 0.5;      //0.5 =rounf off
 
" variable.rtc_present_data[8] "  is the calibration register of RTC. In this register MSB bit will be 0 or 1, Its depend on your RTC which is second gained or lost. if it is lost then it  must be set 1.
qhb
Superb Member
  • Total Posts : 9665
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Status: online
Flagged as Spam (1)
Re: RTC MCP7940N calibration 2018/11/04 16:40:41 (permalink) ☄ Helpfulby Jim Nickerson 2018/11/05 06:33:21
5 (3)
You don't mention what processor you are running this on, what compiler, or what precision your variables are.
 
Jim Nickerson
User 452
  • Total Posts : 5842
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: RTC MCP7940N calibration 2018/11/05 06:30:21 (permalink)
5 (2)
qhb
You don't mention what processor you are running this on, what compiler, or what precision your variables are.

I wonder why anyone would have flagged this post as spam ?
Jim Nickerson
User 452
  • Total Posts : 5842
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: RTC MCP7940N calibration 2018/11/05 06:37:19 (permalink)
5 (1)
You did note the processor and asking what processor seems not to rise to the level of spam, a down vote maybe but surely not flagging as spam.
Jim Nickerson
User 452
  • Total Posts : 5842
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: RTC MCP7940N calibration 2018/11/05 06:40:28 (permalink)
5 (1)
I wonder if you have seen AN1496 ?
 

Attached Image(s)

amtech
Starting Member
  • Total Posts : 34
  • Reward points : 0
  • Joined: 2014/08/12 22:37:56
  • Location: 0
  • Status: offline
Re: RTC MCP7940N calibration 2018/11/12 22:16:03 (permalink)
0
I used the microchip processor : dsPIC33EP512MC506
compiler : XC16 V1.21
what precision your variables are: I USED int variable.
Guest
Quick Reply: (Open Full Version)
  Enter the random characters shown
Submit Post
Some restrictions apply to prevent link (URL) Spam.
URLs in messages, signatures, and PM's are removed unless you have ...
  • been a member for at least 0 day(s);
  • made a total of 0 post(s);
  • earned at least 0 point(s) for post scores (based on the ratings on your posts);
  • earned at least 0 reward point(s);
Jump to:
© 2019 APG vNext Commercial Version 4.5