;
; See i2clib.asm for documentation of the interface to this file.
- ; include /usr/share/gputils/header/p18f458.inc
- ; radix dec
- ; include ../iwjpictest/insn-aliases.inc
+ include /usr/share/gputils/header/p18f458.inc
+ radix dec
+ include ../iwjpictest/insn-aliases.inc
- ; include ../iwjpictest/clockvaries.inc
- ; include panic.inc
- ; include morse+auto.inc
- ; include i2clib.incm
+ include ../iwjpictest/clockvaries.inc
+ include panic.inc
+ include morse+auto.inc
+ include i2clib.incm
- include common.inc
;======================================================================
; NOTATION
;----------
i2cm_interrupt
- D 0x50 ;!P
bt_f_if0 PIR1, SSPIF
return
; We have an interrupt:
;...
i2cm_interrupt_definite
- D 0x51 ;!P
mov_ff SSPSTAT, sspstat
mov_ff SSPCON1, sspcon1
mov_ff SSPCON2, sspcon2
and_wfw sspcon1
bra_nz m_event_bad
- mov_fw st ;!P
- call debugbyte ;!P
-
; No ? Well, then the I2C should be idle now:
mov_fw sspcon2
- call debugbyte ;!P
and_lw ~((1<<ACKSTAT) | (1<<ACKDT)) ; those two are ok if set
bra_nz m_event_bad
; OK...
;----------
m_event_done_addressing
bt_f_if1 sspcon2, ACKSTAT
- bra m_bad_address_ack
+ bra m_no_address_ack
; OK, we got ack.
bc_f st, st_addressing
goto i2cmu_done
;----------
-m_bad_address_ack
- i2cpanic morse_SK
+m_no_address_ack
+ bt_f_if0 st, st_reading
+ bra m_bad_no_address_ack_write
+ clr_f st
+ rcall m_stop
+ goto i2cmu_slave_no_ack
+
+m_bad_no_address_ack_write
+ panic morse_SW
;========================================
; MASTER - WRITING
include program+externs.fin
include i2clib.inc
- include variables+vars.fin
-
end