chiark / gitweb /
use NMRA timing parameters from program.clocks
authorian <ian>
Thu, 29 Dec 2005 17:04:58 +0000 (17:04 +0000)
committerian <ian>
Thu, 29 Dec 2005 17:04:58 +0000 (17:04 +0000)
detpic/nmra-stream.asm
detpic/program.clocks

index 2a13bd1f0afc40ac536457abe8b058ac5128dcff..7e68bdfc03ee7a41b5ddf2f54078d5c96664dfa2 100644 (file)
@@ -136,15 +136,17 @@ nmra_init @
        endif
 
         bc_fa     T0CON,5         ; timer0 use internal clock
-        bc_fa     T0CON,3         ; use prescaler
 
        ifndef  SLOW_VERSION
-        bc_fa     T0CON,2         ; }
-        bc_fa     T0CON,1         ; } prescale value 1:2
-        bc_fa     T0CON,0         ; } (not-testing)
+       mov_fw  T0CON
+       and_lw  ~((1<<PSA)|(1<<T0PS2)|(1<<T0PS1)|(1<<T0PS0))
+       ior_lw  nmra_master_t0scale
+       mov_wf  T0CON           ; prescale value calculated from
+                               ;  program.clocks (not-testing)
        endif
 
        ifdef   SLOW_VERSION
+        bc_fa     T0CON,3         ; use prescaler
         bs_fa     T0CON,2         ; }
         bc_fa     T0CON,1         ; } prescale value 1:16
         bc_fa     T0CON,0         ; } (testing)
@@ -304,7 +306,7 @@ master_interrupt_high @
        endif
 
        ifndef  SLOW_VERSION
-       mov_lw  0x73    ; (not-testing)
+       mov_lw  nmra_master_t0init
        endif
 
        mov_wfa TMR0L           ; set timer0 to appropriate value (so interrupt takes 58us)
index ae0066e8454096395d1b3eba773d20f4352d6125..f4d1ea427cc87af6ca1871c4b72ce47835c9811a 100644 (file)
@@ -10,6 +10,7 @@
 
 points         MS      T3ov            10ms
 tick           MS      T2period        1ms
+nmra           M       T0ov8           58us-8cy
 
 ; we do morse at 18wpm according to the PARIS standard
 ; (ie a unit time of 66ms) using timer0 (DS p108)