Page 1 of 1

Wake from SLEEP using TMR1 interrupt

Posted: Thu May 26, 2016 12:40 pm
by Dave Squibb
Hello,
I am trying to make a PIC16F88 wake from SLEEP using an interrupt on TMR1. I have a 32KHz xtal running on B6 and B7, the main xtal is 10MHz. I have attached the program. The program runs without the first SLEEP instruction. Both oscillators run, the 10MHz stops in SLEEP. Could someone have a look please?
Thanks, Dave.
Flowcode1.fcfx
(4.77 KiB) Downloaded 294 times

Re: Wake from SLEEP using TMR1 interrupt

Posted: Thu Jun 02, 2016 5:06 pm
by Dave Squibb
Still no joy with this. I assume I am correct in selecting HS in the config for the main 10MHz oscillator
and then TMR1 interrupt Clock Source Select as 32.768KHz Xtal T1CKI/T1CKO ?

Re: Wake from SLEEP using TMR1 interrupt

Posted: Fri Jun 03, 2016 12:37 pm
by Dave Squibb
Finally got this working. If anyone has this problem in the future add the C code "set_bit(t1con,2);" after the flowcode TMR1 interrupt enable Macro (on my flowchart above).

From PIC16F88 data sheet:

T1CON bit 2 T1SYNC: Timer1 External Clock Input Synchronization Control bit
TMR1CS = 1:
1 = Do not synchronize external clock input
0 = Synchronize external clock input
TMR1CS = 0:
This bit is ignored. Timer1 uses the internal clock when TMR1CS = 0.

Dave.