last1 res 1
last2 res 1
+buf0_startval res 1 ; reversers start with some det bits
buf0 res 1
message_buffer res max_messages
message_buffer_end
;----------
det_slave_setup
- clr_f scana
- clr_f scanb
- clr_f scanc
- clr_f scand
- clr_f scane
+ set_f scana
+ set_f scanb
+ set_f scanc
+ set_f scand
+ set_f scane
+
+ clr_w
+
+ bt_f_if0 idloc1,idloc1_boarddet
+ mov_lw 0x14 ; see under reversers, below
+
+ mov_wf buf0_startval
+
goto reset_message_buffer
;----------
det_scanloop_detectors
rr_fw PORTB ; W xx xx xx xx 04 20 17 xx (now)
- ior_wff scanb ; b xx xx xx xx 04 20 17 xx (cumulative)
+ and_wff scanb ; b xx xx xx xx 04 20 17 xx (cumulative)
rl_fw PORTA ; W 19 09 12 15 18 xx xx xx (now)
- ior_wff scana ; a 19 09 12 15 18 xx xx xx (cumulative)
+ and_wff scana ; a 19 09 12 15 18 xx xx xx (cumulative)
rr_fw PORTE ; W 06 xx xx xx xx xx 03 00 (now)
- ior_wff scane ; e 06 xx xx xx xx xx 03 00 (cumulative)
+ and_wff scane ; e 06 xx xx xx xx xx 03 00 (cumulative)
swap_fw PORTD ; W 08 xx 01 07 02 11 14 xx (now)
- ior_wff scand ; d 08 xx 01 07 02 11 14 xx (cumulative)
+ and_wff scand ; d 08 xx 01 07 02 11 14 xx (cumulative)
mov_fw PORTC ; W xx xx 05 xx xx 10 13 16 (now)
- ior_wff scanc ; c xx xx 05 xx xx 10 13 16 (cumulative)
+ and_wff scanc ; c xx xx 05 xx xx 10 13 16 (cumulative)
det_scanloop_again det_scanloop_detectors
mov_wf POSTINC2
mov_wf last2
- clr_f scanb
- clr_f scanc
- clr_f scane
+ set_f scanb
+ set_f scanc
+ set_f scane
;...
;----------------------------------------------------------------------
; both detectors and reversers
;
both_startread_tail
- clr_f scana
- clr_f scand
+ set_f scana
+ set_f scand
call led_green
set_f unattended
reset_message_buffer
; FSR1/buf0/message_buffer any set to empty
mov_lfsr message_buffer, 1
- clr_f buf0
+ mov_ff buf0_startval, buf0
clr_f INDF1
return
; E xx xx xx xx xx 02 xx xx
det_scanloop_reversers
rr_fw PORTA ; W xx xx 01 xx 03 xx xx xx (now)
- ior_wff scana ; a xx xx 01 xx 03 xx xx xx (cumulative)
+ and_wff scana ; a xx xx 01 xx 03 xx xx xx (cumulative)
mov_fw PORTD ; D xx xx xx xx xx xx 04 05 (now)
- ior_wff scand ; d xx xx xx xx xx xx 04 05 (cumulative)
- bt_f_if1 PORTC,2 ; 00 (now)
- bs_f buf0,2 ; buf0 MM zz zz ss zz 00 zz zz (cumulative)
- bt_f_if1 PORTE,2 ; 02 (now)
- bs_f buf0,4 ; buf0 MM zz zz 02 zz ss zz zz (cumulative)
+ and_wff scand ; d xx xx xx xx xx xx 04 05 (cumulative)
+ bt_f_if0 PORTC,2 ; 00 (now)
+ bc_f buf0,2 ; buf0 MM zz zz ss zz 00 zz zz (cumulative)
+ bt_f_if0 PORTE,2 ; 02 (now)
+ bc_f buf0,4 ; buf0 MM zz zz 02 zz ss zz zz (cumulative)
det_scanloop_again det_scanloop_reversers
;---------- ; buf0 MM zz zz 02 zz 00 zz zz
det_slave_read_start_reversers
- mov_wf scana ; W xx xx 01 xx 03 xx xx xx
+ mov_fw scana ; W xx xx 01 xx 03 xx xx xx
and_lw 0x28 ; W zz zz 01 zz 03 zz zz zz
ior_wff buf0 ; buf0 MM zz 01 02 03 00 zz zz
- mov_wf scand ; W xx xx xx xx xx xx 04 05
+ mov_fw scand ; W xx xx xx xx xx xx 04 05
and_lw 0x03 ; W zz zz zz zz zz zz 04 05
ior_wfw buf0 ; W MM zz 01 02 03 00 04 05
+;;;;;;for testing:
+; mov_fw scana
+
call i2cs_read_data
mov_lfsr outbuf, 2