chiark / gitweb /
ticks wip
authorian <ian>
Tue, 20 Dec 2005 16:14:12 +0000 (16:14 +0000)
committerian <ian>
Tue, 20 Dec 2005 16:14:12 +0000 (16:14 +0000)
detpic/common.inc
detpic/program.clocks
detpic/tick.asm [new file with mode: 0644]

index 5deed7520107aad0f8bd05e364580c464fc678fd..0225e8d03874a218527e74352e7345d0676b6251 100644 (file)
@@ -74,9 +74,9 @@ clock equ -1
 ;
 ;                      Master                  Slave
 ;  Timer 0             nmra                    Disabled
-;  Timer 2             -                       -
-;  Timer 1             (1ms tick, int. low)    (1ms tick, int. low)
-;  CCP1                        (1ms tick, int. low)    (1ms tick, int. low)
+;  Timer 2             (10ms tick, int. low)   (10ms tick, int. low)
+;  Timer 1             -                       -
+;  CCP1                        -                       -
 ;  Timer 3             point fire timer        point fire timer
 ;  ECCP                        -                       -
 ;
index 8c481c66604da051fd8cb74f98239a6bcbb596cd..1b4987472bac813f7ac518f88809814fcf1a6ad1 100644 (file)
@@ -11,3 +11,4 @@
 #morse         MS      T0ov16          66ms
 points         M       T3ov            20ms
 points         S       T3ov            10ms
+tick           MS      T2period        10ms
diff --git a/detpic/tick.asm b/detpic/tick.asm
new file mode 100644 (file)
index 0000000..70a9095
--- /dev/null
@@ -0,0 +1,31 @@
+;======================================================================
+; TICKER - regular 10ms timer interrupt
+;
+; after ticker_init, and after interrupts enabled,
+; we call <foo>_tick every 10ms.
+
+;----------------------------------------
+ticker_init
+;  Timer 2             not used                used for ticker
+       mov_lw  tick_timer2period
+       mov_wf  PR2
+       mov_lw  tick_timer2scale | (1<<TMR2ON)
+       
+
+       mov_lw  b'1011'         ; Compare mode, Special event
+       mov_wf  CCP1CON
+
+       t3con
+       t1con
+
+       clr_f   TMR1L
+       clr_f   TMR1H
+
+       bc_f    IPR1, TMR1IP
+       bc_f    IPR1, CCP1IP
+       bc_f    PIR1, TMR1IF
+       bc_f    PIR1, CCP1IF
+       bs_f    PIE1, TMR1IE
+       bs_f    PIE1, CCP1IE
+
+T3CCP2