prescaler won' work on 12f508

  • salvo

    salvo - 2012-03-02

    hi to everybody
    i need to assign a 1/8 prescaler to tmr0
    i used the command "init tmr" (init timer 0 ps0 1/8), but when i compile no error reported but the routine does not work.
    with the same routine if i change the chip and use the 12f675 it work perfectly.
    can some body help me with this?
    thank you very much

  • kent_twt4

    kent_twt4 - 2012-04-06

    Using the baseline PIC's is always a treat =).  Don't have the time to look at the library, but you can try the following code to set the maximum prescaler.  I think option_reg could be used now instead of asm option?, this is some older code.

    movlw   B'01000111' ;bit 7 GPWU 0 = enables wake on pin change
                        ;bit 6 GPPU 0 = enables weak pullups on GP0, GP1, GP3
                        ;bit 0-2 assign prescaler to TMR0 prescale
    asm option
  • salvo

    salvo - 2012-04-07

    hello kent
    i was close to add a post here
    i solved writing manully the asm code to set the option reg.
    movlw B'11000010'
    also i needed to reset the option reg after every tmr0 clearing, because when you clear tmr0 you clear also the prescaler too.
    now my speed regulator for rc models work perfectly


Log in to post a comment.