View previous topic :: View next topic |
Author |
Message |
curt2go
Joined: 21 Nov 2003 Posts: 200
|
Timer1 and 67k22 |
Posted: Fri Jan 13, 2017 11:21 am |
|
|
I am either missing something in the documentation or just having an off day. I am using the SOSC to run the timer1 for a real time clock. I need the clock to keep running when in sleep(); I thought this was possible but it is not triggering the interrupt in sleep(); This is what I am using to initialise the Timer1. Any help would be great. Thanx guys.
Compiler verison is 5.056.
Code: | setup_timer_1(T1_EXTERNAL_SYNC|T1_DIV_BY_1 | T1_ENABLE_SOSC ); |
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Fri Jan 13, 2017 11:35 am |
|
|
You NEED to post your program, not just one line ! We have NO idea if you've enabled the timer interrupt. That one line does NOT enable the timer1 interrupt capability of the PIC.
Jay |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Fri Jan 13, 2017 11:35 am |
|
|
Well this happens to me all the time. I post a question and then i look at what I posted, try a couple things and then i figure it out.
Problem solved. should not have had T1_EXTERNAL_SYNC just T1_EXTERNAL. |
|
|
curt2go
Joined: 21 Nov 2003 Posts: 200
|
|
Posted: Fri Jan 13, 2017 11:38 am |
|
|
Sorry I should have stated that the interrupt was working fine. Just not when i put the PIC to sleep. But I have it now. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19497
|
|
Posted: Fri Jan 13, 2017 11:56 am |
|
|
Well done.
Makes sense if you think about it. Using 'sync', the clock is synchronised to transitions of the master oscillator. Asleep, this is off.... |
|
|
|