chiark / gitweb /
master waits a bit before starting so that slaves can wake up
authorian <ian>
Sat, 19 Jan 2008 16:33:21 +0000 (16:33 +0000)
committerian <ian>
Sat, 19 Jan 2008 16:33:21 +0000 (16:33 +0000)
detpic/program.asm
detpic/program.clocks

index a2b904c74b07912e270200dca881c1783862abac..01ebfbb6cc5f3c2680f6abb92778b892744c65b5 100644 (file)
@@ -60,6 +60,7 @@ master_init
        call    memory_erase
        clr_f   flags
        call    serial_init
+       call    startwait
        call    i2cm_init
        call    serialtxbuf_init
        call    polarity_master_init
@@ -88,6 +89,27 @@ master_interrupt_low @
        call    i2cm_intrl
        panic   morse_IL
 
+;----------------------------------------
+startwait
+; We pause before starting up to give slaves a chance to wake up.
+;
+;  Timer 0             any             trashed, left running
+;  GIEH, GIEL          remain continuously disabled
+;
+       clr_f   T0CON
+       bc_f    INTCON,TMR0IF
+       mov_lw  startwait_master_t0inith
+       mov_wf  TMR0H
+       mov_lw  startwait_master_t0initl
+       mov_wf  TMR0L
+       mov_lw  (1<<TMR0ON) | startwait_master_t0scale
+       mov_wf  T0CON
+startwait_loop
+       bt_f_if0 INTCON,TMR0IF
+       bra     startwait_loop
+       ;...done.
+       return
+
 ;----------------------------------------------------------------------
 serialrx_table_section code    0x2000
 
index 8584d2e1e5f1d420991c2ad731ef9507b1eaa251..ff85d79f3b52db7a459c0c88750d3be8de39f928 100644 (file)
@@ -1,16 +1,22 @@
 # Each line is:
-#  <name>      M|S|MS          how     interval
+#  <name>      M|S|MS[T]       how     interval
 # where how is one of
-#  T1ov T3ov
+#  T0ov8 T0ov16 T1ov T3ov
 #      set  T[13]CON to  <stuff> | <name>_{master,slave}_t[13]scale
 #      load TMR[13][HL] with  <name>_{master,slave}_t[13]init[hl]
 #       or to put it another way, TMR[13] with
 #              65535 - <name>_{master,slave}_t[13]cycles
 #      then time to overflow will be specified time
+#  T2period
+#      set T2CON to  <stuff> | <name>_{master,slave}_t2scale
+#      set PR2 to  <name>_{master,slave}_t2cycles
+# M and S mean generate <name>_{master,slave}_<things> respectively
+# T means generate <name>_{us,ms}
 
 points         MS      T3ov            10ms
 tick           MST     T2period        1ms
 nmra           M       T0ov8           58us-10cy
+startwait      M       T0ov16          10ms
 
 ; we do morse at 18wpm according to the PARIS standard
 ; (ie a unit time of 66ms) using timer0 (DS p108)