From: ian Date: Sat, 19 Jan 2008 16:33:21 +0000 (+0000) Subject: master waits a bit before starting so that slaves can wake up X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=79749789108df66dee6fd4c15a85c70c0f6aab7d;p=trains.git master waits a bit before starting so that slaves can wake up --- diff --git a/detpic/program.asm b/detpic/program.asm index a2b904c..01ebfbb 100644 --- a/detpic/program.asm +++ b/detpic/program.asm @@ -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< M|S|MS how interval +# M|S|MS[T] how interval # where how is one of -# T1ov T3ov +# T0ov8 T0ov16 T1ov T3ov # set T[13]CON to | _{master,slave}_t[13]scale # load TMR[13][HL] with _{master,slave}_t[13]init[hl] # or to put it another way, TMR[13] with # 65535 - _{master,slave}_t[13]cycles # then time to overflow will be specified time +# T2period +# set T2CON to | _{master,slave}_t2scale +# set PR2 to _{master,slave}_t2cycles +# M and S mean generate _{master,slave}_ respectively +# T means generate _{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)