Real time clock library RTCC PIC24 MIKROC

General discussion on mikroC for dsPIC30/33 and PIC24.
Post Reply
Author
Message
mikroX
Posts: 27
Joined: 26 Dec 2009 02:12

Real time clock library RTCC PIC24 MIKROC

#1 Post by mikroX » 30 Dec 2009 15:51

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 :)

Sobrietytest
Posts: 619
Joined: 05 Jul 2008 06:05
Location: Thailand

#2 Post by Sobrietytest » 02 Jan 2010 07:59

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

mikroX
Posts: 27
Joined: 26 Dec 2009 02:12

reply Sobrietytest

#3 Post by mikroX » 02 Jan 2010 17:38

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
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

Post Reply

Return to “mikroC for dsPIC30/33 and PIC24 General”