CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Checking Master Interrupts (while reading) in I2C

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sfingerh
Guest







Checking Master Interrupts (while reading) in I2C
PostPosted: Thu Jan 23, 2003 10:08 pm     Reply with quote

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 2003
Posts: 21708

View user's profile Send private message

Re: Checking Master Interrupts (while reading) in I2C
PostPosted: Fri Jan 24, 2003 1:13 pm     Reply with quote

:=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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group