1 ;======================================================================
2 ; TICK - REGULAR 10MS TIMER INTERRUPT
4 ; after tick_init, and after interrupts enabled,
5 ; we call <foo>_tick every 1ms and <foo>_tickdiv every <tickdiv>ms.
13 ;----------------------------------------
15 ; Timer 2 any used for tick
16 mov_lw tick_master_t2scale ; disable (in case already running)
18 mov_lw tick_master_t2cycles
20 bc_f PIR1, TMR2IF ; clear any previous interrupt
21 bc_f IPR1, TMR2IP ; low priority
22 bs_f PIE1, TMR2IE ; enable interrupts
23 bs_f T2CON, TMR2ON ; enable timer
28 ;----------------------------------------
32 ; we have an interrupt
36 ; add calls to <foo>_tick here:
38 call power_polarising_tick
39 ; end of list of calls to <foo>_tick
41 dec_f_ifz tickdiv_count
46 ;----------------------------------------
48 ; add calls to <foo>_tickdiv here:
49 call power_fault_tickdiv
52 ; end of list of calls to <foo>_tickdiv
58 ;----------------------------------------------------------------------