How to configure CCP1 to reset Timer1 in PIC24FJ ?
Posted: Fri May 03, 2019 8:01 am
CCS v5.078
PIC24FJ1024GB610
I have a 32.768KHz crystal connected to Timer 1 oscillator and I need to generate a flag, without firing an interrupt, (I will read the flag by software) every time the timer 1 reach 8192.
On PIC18F I have a special event trigger that do that and also reset the TMR1 so I get 1/4 sec. periods.
On PIC24FJ seems to be way more complex because the CCP and TMR modules are much more configurable.
I'm reading the file 24FJ1024GB610.h and the MCCP/SCCP/PWM datasheet section and I get a mess in my head.
Could somebody please give a light on it? _________________ Electric Blue
Ttelmah
Joined: 11 Mar 2010 Posts: 19589
Posted: Fri May 03, 2019 10:48 am
You don't actually need the CCP.
On the PIC24, you can program the count limit for the timer. So just set
the timer to count to 8192. It'll reset at this point, and set the timer1
interrupt flag.
Just test this as your 'flag' (if (interrupt_active(INT_TIMER1).
Clear this with 'clear_interrupts'.
So long as you don't have the timer1 interrupt enabled, no interrupt
handler will be called.
E_Blue
Joined: 13 Apr 2011 Posts: 417
Posted: Fri May 03, 2019 11:51 am
So, instead of read the CCP datasheet I will read the Timers datasheet.
Thanks. _________________ Electric Blue
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum