Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

RTCC on PIC24FJ64GA004 for timing up to years

Status
Not open for further replies.
Hello,

I need to select a PIC for an emergency light......it must do various levels of automatic battery tests depending on how many years of operation have elapsed.

So can the RTCC on the PIC24FJ64GA004 do timing over this long period?

Why not? It's a real time clock and calendar that can keep track of years. So, it shouldn't be a problem, provided the RTCC module is powered up all the time.

But, when you say "many years of operation", what do you mean by many? 3-4 years or more like 10-20 years? The latter might be a problem depending on your circuit and chosen components.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
The program memory (Flash) of the PIC24FJ64GA004 has a 20-year minimum data retention rating.


However, it should be noted, virtually all crystals have an initial error, drift due to temperature and drift due to aging.

Therefore, some method of recalibration and compensation should be implemented into the design as the accumulated error can be quite significant, particularly over a period of years.

When properly calibrated, the RTCC module of the PIC24FJ64GA004 can offer an error of less than three seconds per month.

Reference: Section 18.2 Calibration.


BigDog
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
I understand the application as a basic operating hours counter problem. It doesn't actually need a calendar and calibration won't be an issue.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
Thanks,

The application is an emergency light. When the mains fails the micro turns the light on via the battery. Every month, the micro must instigate a battery test (simply discharging and recharging thebattery), and every year it must do a longer batery test.

So i need to time a period of a year.

If i am using the PIC24FJ64GA004, then i obviously need a 32.768KHz crystal on the SOSCx pins.

However, that oscillator speed is too slow for the general functioning, so can i use the 8MHz internal oscillator aswell as the 32.768KHz external crystal?


...ie, just use the 32.768KHz crystal for the calendar, and use the 8MHz internal oscillator for the general program execution?
 

...ie, just use the 32.768KHz crystal for the calendar, and use the 8MHz internal oscillator for the general program execution?

Yes. You need to have a good read of the oscillator section - primary & secondary oscillator - as well as TIMER1 and RTCC sections. Also, don't forget that the main data sheet only contains partial information for the PIC24F series - you need to download the detailed Family sections as well.

Keith
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
.....as an alternative, would i be better advised to simply place a 4MHz extrnal crystal on the OSCx pins, and use that as THE sole oscillator in the system?.....ie, use it for the RTCC calendar and the general program execution?

....or is it that the RTCC literally does not work with a crystal of value any other than 32.768KHz?
 

The whole point of the RTCC is it takes little power. The RTCC can run when the processor is asleep - around 13uA at 3.3V. Of course, you don't need to use the RTCC to measure time - it just makes it easier.

Keith.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
....though if i dont use the RTCC, then i dont get the benefit of all those alarms and such like as on page 180 of the PIC24FJ64GA004 datasheet (above).

So, if i am wise, then surely i will "not" elect to use a 4MHz crystal?, but will elect to use the 32.678KHz crystal on the SOSCx pins, and then use the internal 8MHz oscillator for general program execution?

And if i find that i do not need quick execution time, then my wisest-of-all option would be to simply put a 32.678KHz crystal on the SOSCx pins, and just use that for the RTCC and for the general system oscillator aswell?
 

As you say, you will not get the alarms and automatic day/week calculation etc.

The problem is, there is no "right" way to do what you want. There are many way of doing it. You can run the 32kHz and 8MHz clocks simultaneously and disable the 8MHz clock when you don't need it but leave the 32kHz clock running the CPU. You can use the 32kHz timer to simply generate interrupts for the CPU and time everything in software.

For a product where the software is easier to understand in the future and which makes best use of the processor facilities, you would use the RTCC with an external crystal driving timer1 and make the processor sleep when not needed. It will take a bit more reading to get it all working in the first place but probably involves less software writing and will give the most power efficient solution.

Keith
 
  • Like
Reactions: vinnnie and treez

    T

    Points: 2
    Helpful Answer Positive Rating

    vinnnie

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top