Hi,
I'm configuring 2 PIC16f873 to communicate (Master-Slave) using I2C.
Now it's working. I can write to the Slave and read from it. :-)
(it took some days).
But I want to have control over every interrupt (or at least know why they happen).

I enabled only GLOBAL and INT_SSP interrupts.
Situation:
The master wants to read. It Start's, sends the Address and then it i2c_read()'s. After the Slave sends the byte, the Master Pic enters two times the I2C interrupt routine (#int_ssp) WHY?

I want to know, so I can do a SWITCH-CASE interrupt routine. SSSPIF is the one who trigger both intterrupts, but what is the difference between this two cases? (See Figure I2C Master Mode Timing [Reception] on the PIC16F87x DataSheet or AN735)
Wich bit I have to test? The first interrupt is because Buffer is full (BF=set). But on the second one, some ACK bit should be set, but it isn't. (I think it is, but maybe the #int_ssp routine cleared it).

How can I know the Status?

Thank you

Sebastian
___________________________
This message was ported from CCS's old forum
Original Post ID: 10956

PCM programmer

Joined: 06 Sep 2003Posts: 20404

Re: Checking Master Interrupts (while reading) in I2C

Posted: Fri Jan 24, 2003 1:13 pm

:=Hi,
:=I'm configuring 2 PIC16f873 to communicate (Master-Slave) using I2C.
:=Now it's working. I can write to the Slave and read from it. :-)
:=(it took some days).
:=But I want to have control over every interrupt (or at least know why they happen).
:=
:=I enabled only GLOBAL and INT_SSP interrupts.
:=Situation:
:=The master wants to read. It Start's, sends the Address and then it i2c_read()'s. After the Slave sends the byte, the Master Pic enters two times the I2C interrupt routine (#int_ssp) WHY?
----------------------------------------------------------
The 16F87x data sheet has a timing diagram called,
"i2c Master Mode Timing (Reception, 7 bit Address)".
This is Figure 9-15. It shows two pulses on the SSPIF
signal at the end of a received byte. The first one
is for the "end of receive" and the 2nd one is for the
acknowledge.

The MSSP reference manual has some more information
than the data sheet. Download the "Master Synchronous
Serial Port" document:
<a href="http://www.microchip.com/1000/suppdoc/refernce/midrange/index.htm" TARGET="_blank">http://www.microchip.com/1000/suppdoc/refernce/midrange/index.htm</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 10972