From a94b68175866789ba4a69cb5ddbe2b80ce2b92fa Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 21 Dec 2005 15:44:18 +0000 Subject: [PATCH] i2cmu_read_got_byte - main scanning loop - wip --- detpic/mascan.asm | 67 +++++++++++++++++++++++++++++++++++++++++-- detpic/morse.messages | 1 + 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/detpic/mascan.asm b/detpic/mascan.asm index b80e107..f1d4f25 100644 --- a/detpic/mascan.asm +++ b/detpic/mascan.asm @@ -2,8 +2,35 @@ ; MASTER - SCANNING ETC. include common.inc - code + 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 ;====================================================================== ;---------------------------------------- @@ -16,8 +43,44 @@ i2cm_intrl intrl_handled_nostack ;---------------------------------------- -i2cmu_done 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 diff --git a/detpic/morse.messages b/detpic/morse.messages index 82083a3..8a02152 100644 --- a/detpic/morse.messages +++ b/detpic/morse.messages @@ -48,6 +48,7 @@ UM UE UC UI +UX # Messages for i2clib, S* SM i2clib:st,:sspstat,:sspcon1,:sspcon2 ; m.,i., ctrlr bad state -- 2.30.2