;====================================================================== ; MASTER - SCANNING ETC. include common.inc udata_acs cslot res 1 ; current slave in slave table, points to flags byte main res 1 ; one of the following: ; 0000 0000 we're expecting the first byte ; ; M0BB 0001 we have rec ; M0BB 0001 we have rec ; MM zz B2 B1 zz zz zz II ; ; main byte from slave ; X0BB0000 ; where X is 1 iff we're expecting an `extra byte' ; otherwise NN is the detection byte we're expecting sc res 1 sc_extra equ 7 ; we're slavetable_section udata 0x280 slavetable res maxpics * 2 ; each entry is: ; 1 byte slave number ; 1 byte flags ; 00DD0000 where D is 1 iff a detectors board code ;====================================================================== ;---------------------------------------- i2cm_intrl ; handles i2c interrupt using i2cm_interrupt[_definite], ; according to the rules for _intrl. bt_f_if0 PIR1, SSPIF return call i2cm_interrupt_definite intrl_handled_nostack ;---------------------------------------- i2cmu_read_got_byte ; Beforehand At call ; State Reading Reading-Wait ; W data from slave ; ; See detect.asm head comment for protocol info, in particular ; the meaning of these bytes. mov_wf t ; remember the byte for a moment mov_lw slavetable >> 8 mov_wf FSR1H mov_ff cslot, FSR1L tst_f_ifnz cbyte bra read_got_notfirst ; this is a first (head) byte: and_wfw POSTINC1, bt_f_if1 cbyte, 4 bra read_got_moredet1 bt_f_if1 cbyte, 5 bra read_got_moredet2 mov_fw cbyte bra_n read_got_extra bra_nz read_got_moredet bt_f_if1 sc, sc_extra bra got_read_extra got_read_extra panic morse_UX ;---------------------------------------- i2cmu_done i2cmu_write_next_byte panic morse_UI ;====================================================================== include final.inc