View previous topic :: View next topic |
Author |
Message |
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Thu Oct 22, 2020 4:27 pm Post subject: MCP79520 RTC over SPI with Bascom |
|
|
Hello.
This is the basic example of handling this RTC with the Bascom syntax like $Tme & $Date
It work over SPI not I2C.
Chip have 64Bytes of battery keeped/powered RAM and some Eeprom.
It can tell when power was down and when it rise up again.
Ofcourse two alarms are also available.
Can be digitaly calibrated by one register. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri Oct 23, 2020 12:08 pm Post subject: |
|
|
Excellent work EDC.
Thanks for sharing your work.
I see the attachment is complete with PDF and code.
If you dont mind i add it to the bascom samples. _________________ Mark |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Fri Oct 23, 2020 10:36 pm Post subject: |
|
|
Okay. ::::::
I need it and must use it ...and with bascom it was easy |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Sat Oct 24, 2020 10:09 am Post subject: |
|
|
Hi EDC
I use DS3231 with internal cristal. It is a TCXO (very higt precision ) and I2C connexion (2 wires and it lets SPI for AVRdos or others) Why did you prefer yours ?
I'm only curious
JP
_________________ pleasure to learn, to teach, to create |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Sun Oct 25, 2020 7:28 am Post subject: |
|
|
Cause my AVR device is also I2C slave. In this project Im also using AVR-DOS and W5500 Ethernet chip so..for SPI it is not a problem... |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Nov 25, 2021 10:56 am Post subject: |
|
|
thanks for the update. indeed this is valuable info _________________ Mark |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Mon Mar 11, 2024 11:53 pm Post subject: |
|
|
Since only this year February had 29 days and we have a leap year another small error came out.
The RTC itself recognizes such a year and sets bit 5 in the month register.
Therefore, it should be masked when reading it.
Code: | _month = rtc_buff(6) And &B0001_1111 'bit 5 is the read only leap year
_month = Makedec(_month) |
_________________ Check B-Flash -my MCS bootloader app for Android |
|
Back to top |
|
|
|