abdi110
Member level 3
- Joined
- Mar 5, 2015
- Messages
- 60
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,288
- Activity points
- 1,728
Could any one please let me know how to use RTC in AVR?
I would like to have a calendar in my program in order to my program or a part of it be executed in a certain date. Is it possible? and How?
Make sure the RTC is having the back-up battery supply.
Thanks every oneHi,
This would mean to supply the whole AVR with a backup battery.
But the AVR maybe needs 100 time the current of a dedicated RTC IC.
An thus the battery needs 100 times the capacity of an RTC IC battery.
Using the internal RTC in my eyes makes sense:
* If the AVR is continously supplied with power. (stove, microwave ofen, hifi equippment ..)
* or if the AVR has the posibility to adjust its intenal RTC after power loss (internet, DCF77...)
Klaus
I decided to use an external RTC IC because of the power loss case.
So many thanks dear friend for your complete; information I was thinking about ds1307 now I can consider both to select one.
Could you please help me about the battery Circuit? I mean the battery charger circuit and type of battery which is good for this purpose.
Based on the data sheet the battery is connected directly to the chip. I wanted to ask if the battery charger is implemented in the chip? Or I have to make it externally?
Hi,
i´d avoid rechargable batteries for clock backup power supply.
* the clock need only a few uA of current.
* a lithium coin cell lasts for years
* rechargable batteries often have a bigger self discharge than those coin cells
* if you use rechargabe batteries and need to recharge it - lets say - every three month, it is likely you forget them to charge.
* as long as your application is powered it needs no current from the battery
Klaus
One advantage the DS3234 has over the DS3107 is the DS3234 has an integrated temperature compensated crystal oscillator (TCXO) and crystal, therefore no external crystal is required. The DS3234 is quite a bit more stable, ±2ppm, than the DS3107, enabling it to retain a more accurate time.
Typically these types of devices utilize a small coin lithium cell, like the CR1225. The DS3234 only draws a few uA, an average of 1.0uA to 3.0uA, while on battery backup, therefore the life of a small lithium cell is quite reasonable.
Of course you could, utilize a recharge lithium based cell, however you would need to implement an external charging circuit into the design and I'm not sure a cost/benefit analysis would justify it. Some of the Maxim RTCs do incorporate a trickle charger into their design, DS12R885/DS12R887 and DS1340, I'm sure there are other manufactures offering similar devices.
Trickle Charging Lithium Batteries with the ISL1208 and ISL1209 RTC Devices
Selecting a Backup Source for Real-Time Clocks
Battery Charging and Management Solutions
The above appnote details some of the power considerations.
What is the specific end application?
BigDog
Thanks dear friend so I will use a non rechargeable battery it is easier and witj more advantages thanksHi,
i´d avoid rechargable batteries for clock backup power supply.
.
* the clock need only a few uA of current.
* a lithium coin cell lasts for years
* rechargable batteries often have a bigger self discharge than those coin cells
* if you use rechargabe batteries and need to recharge it - lets say - every three month, it is likely you forget them to charge.
* as long as your application is powered it needs no current from the battery
Klaus
if(days < TRIAL_LIMIT) {
//do everything
}
Thanks I do not know how to store some thing in eeprom for example in at mega 8Using timer interrupts make a software clock. Also use eeprom to store number of days used. Read this value into day variable on start up. Create delays as required like 180 days, 360 days... When that much days are over then the device stops functioning.
No need for an RTC if clock is used for trial time expire check. I always do such things. When I give some .hex file for testing I always give code which works for 30 days. Days count is stored in eeprom. The device can be erased and reprogrammed and used for another x days.
Code:if(days < TRIAL_LIMIT) { //do everything }
Thanks but what happens after a power loss or after a turning and off? I think in power loss and resetting the AVR everything goes to first and therefore the time days variable will be set to zero and never reaches to the time limit so the user can turn off and on the system and everything will start from the beginning isn't it?
Thanks Milan but I use code vision could you please help me on this compiler?If you can use mikroC PRO AVR Compiler then I can give you an example of software timer setting trial time for the device.
So thanksActually Milan suggested storing the day count in EEPROM which is nonvolatile, the stored data is retained regardless of power availability. If the day count was stored in SRAM, you would be correct, once power is removed from the device all data, variables, etc, stored in SRAM are lost.
The difficulty maybe detecting repeated removal of the battery from the RTC, thereby resetting it back to a default date. You may need to store the last known date and time of the RTC in EEPROM as well, if the date or time suddenly reverts to the past, then RTC has been reset and a proper course of action can be taken, like expiring the demo. You would need to regularly update the stored date and time with a routine that is scheduled to run at certain intervals.
What AVR will you be using in your design? Disregard, an ATMega 8, which has 512 bytes of EEPROM storage.
BigDog
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?