Hi all
I was wondering what is the purpose of this register?
This is the code that connects the PIC to the RTC timer and the loop below does not stop looping.
Code:
i2c_common_stop macro
;input: none
;output: none
;desc: initiate stop condition on the bus
banksel SSPCON2
bsf SSPCON2,PEN
btfsc SSPCON2,PEN
goto $-1
endm
Well, shouldn't you be looking at the SSPIF flag for command completion? Seems that nearly every command in my MSSP module looks for the flag. So in BASIC syntax:
Code:
sub Stop
SET SSPIF OFF
SET PEN ON 'Set Stop condition
waitStop:
IF SSPIF OFF THEN 'Check if operation complete
goto waitStop
end if
end sub