Hello, I ll do a program based on calendar, i decided to use a PIC24FJ16GA002/004, because will be just one IC, I have many difficulties because I didnt find examples or libraries in MikroC to use internal rtcc
I just found in this forum the code of anton in pascal, but I dont know Pascal, is hard for me to convert in C,
anton library:
http://www.mikroe.com/forum/viewtopic.php?t=16605
I think will be a great job if mikroE team give us some code examples how use mikroc to work, with the internal rtcc of pic24f.
At least convert the anton code to C
Thank u :)
Real time clock library RTCC PIC24 MIKROC
-
- Posts: 619
- Joined: 05 Jul 2008 06:05
- Location: Thailand
I had this working last year but I dumped it in favour of an external RTC, I'll see if I still have the code somewhere although it was only for basic clock functions. The downside of the internal RTCC is that it can't maintain time during a power-down so you either have to have a battery backup for the entire chip or reset the time after every power-down.
Have you read the Microchip document DS39696? This makes everything much clearer. You will also need to remember to use a secondary 32.768kHz oscillator and enable it in the SOSCEN bit of the OSCON register. You have to be careful here especially if you're using dsPRO, as far as I can tell you cannot enable the secondary oscillator from the Edit Project dialog page, so you will have to use this in your initialisation...
OSCON |= 2; // Enables OSCON bit 1 without changing the project oscillator settings
Have you read the Microchip document DS39696? This makes everything much clearer. You will also need to remember to use a secondary 32.768kHz oscillator and enable it in the SOSCEN bit of the OSCON register. You have to be careful here especially if you're using dsPRO, as far as I can tell you cannot enable the secondary oscillator from the Edit Project dialog page, so you will have to use this in your initialisation...
OSCON |= 2; // Enables OSCON bit 1 without changing the project oscillator settings
reply Sobrietytest
Thanks,
I never used PIC24, I was tempted to use because I need to use the rtc, and someone told me why you do not use only one chip (PIC24) instead of 2 (PIC16F887 + rtcchip), my circuit will serve only to generate pwm for the LEDs and show in lcd the date during the night depending on the time, and will be off during daylight
I need battery, to suply rtc during daylight(maybe 3V lith)
maybe I'll use PIC16F + rtc, but this would be a good incentive to start me in the world of PIC24 and dsPIC.
Thanks for your attention
I never used PIC24, I was tempted to use because I need to use the rtc, and someone told me why you do not use only one chip (PIC24) instead of 2 (PIC16F887 + rtcchip), my circuit will serve only to generate pwm for the LEDs and show in lcd the date during the night depending on the time, and will be off during daylight
I need battery, to suply rtc during daylight(maybe 3V lith)
maybe I'll use PIC16F + rtc, but this would be a good incentive to start me in the world of PIC24 and dsPIC.
Thanks for your attention
Sobrietytest wrote:I had this working last year but I dumped it in favour of an external RTC, I'll see if I still have the code somewhere although it was only for basic clock functions. The downside of the internal RTCC is that it can't maintain time during a power-down so you either have to have a battery backup for the entire chip or reset the time after every power-down.
Have you read the Microchip document DS39696? This makes everything much clearer. You will also need to remember to use a secondary 32.768kHz oscillator and enable it in the SOSCEN bit of the OSCON register. You have to be careful here especially if you're using dsPRO, as far as I can tell you cannot enable the secondary oscillator from the Edit Project dialog page, so you will have to use this in your initialisation...
OSCON |= 2; // Enables OSCON bit 1 without changing the project oscillator settings