Truncated match.
PICList
Thread
'P18F - TMR1 as a clock source'
2003\07\31@003230
by
Scott Dattalo
|
Has anyone managed to get an 'f452 running off 32kH'ish clock tied to
TMR1 *and* still use TMR1 as a counter?
Here's what I've got:
The 32kHz clock source is tied to T1OSO, T1OSI pins and works. In other
words, when configured as an asynchronous counter, TMR1 will increment at
the rate at which the 32kHz oscillator clocks it. Everything is great as
long as I clock the CPU off of the main oscillator (which happens to be a
10MHz crystal PLL'd up to 40MHz). However, when I turn on the SCS (switch
clock source) bit in the OSCCON register, the f452 switches over to the
32kHz oscillator as the CPU clock source. At this point, the TMR1
rollovers cease to happen.
The configuration bit for oscillator switch is enabled. In fact, if I
inhibit it, then the processor ignores the write to the OSCCON register.
Here's a sample of somthing I've experimented with:
CLRF temp1 ; *** debug *** loop counter
lowpower_loop:
BSF OSCCON,SCS ;Run off of the 32kHz oscillator
BSF LATA,bLED ;Turn off the Power Consuming LED
lpl1:
CLRWDT
BTFSC PIR1,TMR1IF ;If TMR1 rolls over.
BTG LATA,bLED ;Toggle the LED state
BTFSC PIR1,TMR1IF ;
BCF PIR1,TMR1IF ;and clear the interrupt Flag
DECFSZ temp1,F
bra lpl1
Scott
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads
More... (looser matching)
- Last day of these posts
- In 2003
, 2004 only
- Today
- New search...