Hello.
As far as I know, the check if SPI transmission is complete can be made looking at SSPSTAT,BF flag:
or looking at PIR1,SSPIF interrupt flag:
I don’t understand when to use one and when to use the other.
What’s the difference, if any?
I found cases where checking SSPIF, the code works, while checking BF, it doesn’t.
Thanks in advance for any kind explanation.
Regards
As far as I know, the check if SPI transmission is complete can be made looking at SSPSTAT,BF flag:
Code:
movwf SSPBUF
LOOP
btfss SSPSTAT, BF ;CHECK IF TRANSMISSION IS COMPLETE
goto LOOP
bcf SSPSTAT,BF
or looking at PIR1,SSPIF interrupt flag:
Code:
movwf SSPBUF
LOOP
btfss PIR1, SSPIF ;CHECK IF TRANSMISSION IS COMPLETE
goto LOOP
bcf PIR1,SSPIF
I don’t understand when to use one and when to use the other.
What’s the difference, if any?
I found cases where checking SSPIF, the code works, while checking BF, it doesn’t.
Thanks in advance for any kind explanation.
Regards