call memory_erase
clr_f flags
call serial_init
+ call startwait
call i2cm_init
call serialtxbuf_init
call polarity_master_init
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
# 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)