CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to configure CCP1 to reset Timer1 in PIC24FJ ?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
E_Blue



Joined: 13 Apr 2011
Posts: 403

View user's profile Send private message

How to configure CCP1 to reset Timer1 in PIC24FJ ?
PostPosted: Fri May 03, 2019 8:01 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri May 03, 2019 10:48 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri May 03, 2019 11:51 am     Reply with quote

So, instead of read the CCP datasheet I will read the Timers datasheet.
Thanks.
_________________
Electric Blue
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group