;*******************************************************************************
; INTERRUPT SERVCE ROUTINE
;*******************************************************************************
ORG 0x0004
movlb 0 ; |B0
bsf LedBCL ; |B0
DelayCy (60*msecs)
movlb 4 ; |B4
bcf SSP1CON1,SSPEN ;disable serial port and allow I/O on pins |B4
movlb 1 ; |B1
movlw b'00010000' ;SCL is bit<6>, make output |B1
movwf TRISB ;avoid R-M-W on TRIS |B1
movlb 0 ; |B0
bcf PIR2,BCL1IF ;clear bus collision flag |B0
;set up TMR2 to repetitively pulse SCL until SDA goes high
bsf T2CON,TMR2ON ;turn TMR2 on |B0
bsf PORTB,SCL ; |B0
Pulse
bcf PIR1,TMR2IF ;
btfss PIR1,TMR2IF ;PR2 set to 10 cycles in Start |B0
bra $-1 ; |B0
movlw b'01000000' ; |B0
xorwf PORTB,f ; |B0
btfss PORTB,SDA ; |B0
bra Pulse ; |B0
reset ;need clarify effect of reset on stack |B0
; retfie