PicChip-Prescaler, is it Preserved or Reset to Zero?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
In this example, the prescaler is connected to the oscillator, but I want
to use it elsewhere temporarily.

Does anyone know if the picchip prescaler will reset itself back to zero
because of this, or can I expect the prescaler to hold it's last value?
Reason for asking is for timekeeping, if the prescaler keeps the last
value, then this will keep reasonably good time, otherwise if it resets,
then I've introduced error/drift into my timekeeping.

        clrwdt                  ;make sure WDT doesn't trigger
        movf    TMR0,w          ;hold last TMR0
        movwf   temp
        movlw   b'11111011'     ;need TOCKI, switch prescaler to WDT

        ...do stuff...

        movf    2               ;update TMR0 to new count
        addwf   temp,w
        movwf   TMR0
        movlw   b'11101011'     ;switch prescaler back to OSC


Re: PicChip-Prescaler, is it Preserved or Reset to Zero?
Sorry about that, typed it without checking spelling on code :-(
Code corrected with more comments, still same question.

Quoted text here. Click to load it
        clrwdt
        movf    TMR0,w          ;hold last TMR0
        movwf   temp
        movlw   b'11111011'     ;switch prescaler to WDT
        option                  ;matching option below 32 cycles later

        ...do stuff...

        movlw   2               ;update TMR0 to new count
        addwf   temp,w
        movwf   TMR0
        movlw   b'11100011'     ;switch prescaler to OSC
        option                  ;matching option above 32 cycles ago


Site Timeline