AnsweredAssumed Answered

MC9S08QG8 MTIM inconsistant IRQ timing

Question asked by Paul Savage on Aug 30, 2015
Latest reply on Sep 1, 2015 by Paul Savage

Hi All,


We are using the MTIM module to generate an periodic interrupt for a software loop. When I fine tune the value in the MTIMOD register to get a 10Hz IRQ it works fine. I am toggling a bit to look at the period on a scope. Without changing and code if I reflash the part the value drops from 10.1Hz to 9.66Hz.


Could some one tell us what the problem could be?










;            mov     #%11000011,MTIMMOD  ;load modulo counter value, do not change, 11000011 makes 10.0Hz MTIM IRQ's


;            mov     #%00010011,MTIMCLK  ;select XCLK, prescale div 4, provides 100ms MTIM TOF IRQ's


;            mov     #%01100000,MTIMSC   ;enable overflow interupts, reset and make counter active



;            cli ; enable interrupts






; main loop



;Standby:    wait        ;wait for 100ms modulo timer interrupt to execute Main Loop




;            bset 1,PTBD


;           lda #1


;           jsr DLYXMS


;           bclr 1,PTBD


;           bra Standby