'P18F - TMR1 as a clock source'
|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
BSF OSCCON,SCS ;Run off of the 32kHz oscillator
BSF LATA,bLED ;Turn off the Power Consuming LED
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
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
- New search...