This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Software RTC use TimerA overflow v.s Watchdog timer uses less power?



bis.b   #DIVA_3,&BCSCTL1                  ; divide 32khz crystal by 8 for ACLK
mov.w   #TASSEL_1+MC_2+ID_1+TAIE,&TA1CTL  ; use ACLK and continuous up, div_by_2, irq

With the above routine, the TimerA1 increase at 0.48ms rate and overflow at 32seconds.
As my RTC don't need seconds just rough minutes and the 32second vs 60sec will be handled.
This way it leaves CCR0,CCR01 and CCR02 free

Q:Does Watchdog timer waking up every 8second with TimerA off use less power than TimerA IRQ at 32seconds?
E.G watchdog timer always run even if its IE is not on, so having 1 timer vs 2 timers save power?


 

  • Tony Philipsson said:
    Q:Does Watchdog timer waking up every 8second with TimerA off use less power than TimerA IRQ at 32seconds?

    I am not going to compare watchdog consumption to timer consumption but as both are timers running from same clock, their consumption shall be more or less equal. So what becomes important - CPU cycles which in case of watchdog will be 4 times more compared to timer_a

    Tony Philipsson said:
    watchdog timer always run even if its IE is not on

    You can disable watchdog so it does not run.

  • Ilmars said:
    as both are timers running from same clock, their consumption shall be more or less equal.

    No,. the watchdog is by far simpler, so it will surely consume less power. But you're right, waking up more often likely makes more than up for this.

    Also, using TimerA and not overflow but CCR0 interrupt in up mode allows fine-tuning of the RTC (e.g. triggering an interrupt on 32767, 32768 or 32769 will make a +-30ppm adjustment). Also, the CCR0 interrupt saves a few CPU clock cycles compared to the timer overflow (even if timer runs in cont mode and CCR0 is set to 0). Not much, but well, even 1% more battery life can make a difference :)

  • Counting up to ccr0 would complicate other independent counters on CCR1 and CCR2.
    You would have to check if your TAR+new_delay comes in the window from CCR0 to $FFFF or overflowed $FFFF
    and make up for the difference with additions, hard but not impossible.

    Have anyone made nearly 90% lookup tables RTC?, e.g a loop that runs 6 times that handles second to years
    Here is my RTC that can handle leap years for the next 386 years
    This should replace the TA_over IRQ part here on this post: http://e2e.ti.com/support/microcontrollers/msp430/f/166/p/319180/1111592.aspx#1111592

    TA_over                                     ; last one, no jump is needed
                add.b   #136,&timecarry         ; overflows 0.5625 on avarge , set c
                adc.b   &minute
                cmp.b   #60,&minute
                jhs     addhour
                reti                            ; if not Return from overflow ISR	
    addhour     clr.b   &minute
                inc.b   &hour        
                cmp.b   #24,&hour
                jhs     addday
                reti                            ; if not Return from overflow ISR		
    addday      clr.b   &hour
                inc.b   &day 
                mov.b   &month,R9               ; set 1 to 12
                cmp.b   #2,R9                   ; is it Feb?
                jne     notleap
                tst.b   &year                   ; year 2100, 2200 or 2300? (error on 2400) 
                jz      notleap                 ; as every 4th year except years xx00
                bit.b   #00000011b,&year        ; year 2012, 2016, 2020 all have lower 2bits zero
                jnz     notleap                 ; years x1,x2,x3,x5,x6,x7.x9..... are not leap
                clr.b   R9                      ; if leap use 29days for cmp
    notleap     cmp.b   &day,daysinmonth(R9)
                jlo     addmonth 
                reti                            ; if not Return from overflow ISR	
    addmonth    mov.b   #1,&day
                inc.b   &month        
                cmp.b   #13,&month
                jhs     addyear
                reti                            ; if not Return from overflow ISR	            
    addyear     mov.b   #1,&month
                inc.b   &year        
                cmp.b   #100,&year
                jhs     resetyear            
                reti                            ; if not Return from overflow ISR	            
    resetyear   clr.b   &year
                reti
    daysinmonth dc8   29,31,28,31,30,31,30,31,31,30,31,30,31 ; leapyear + regular months             
                even

**Attention** This is a public forum