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

16F876A SSPADD Register value (General Call Addressing)

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



Joined: 21 Mar 2006
Posts: 9

View user's profile Send private message

16F876A SSPADD Register value (General Call Addressing)
PostPosted: Tue Mar 21, 2006 2:29 am     Reply with quote

Background Info:

PIC: 16F876A
Protocol: I2C

I am communicating with a PIC through I2C using general call addressing. From what I understand, in your code the SSPADD should be assigned the address you give your PIC so it can be referenced when needed. If the PIC is acknoledge by the general call address, will the SSPADD register then hold the general address (0x0000h)
Ttelmah
Guest







PostPosted: Tue Mar 21, 2006 3:28 am     Reply with quote

The pic will interrupt,when an address is received, matching the address in SSPADD. However it can also be programmed to interrupt, when a general call address is received _as well_ (hence the chip will respond to both addresses). This is done by setting the GCEN bit in SSPCON2. So, you enable this, with:
Code:

#byte SSPCON2 = 0x91
#bit GCEN=SSPCON2.7
#byte SSPBUFF = 0x13

//Then in the initialisation code:
GCEN=TRUE;
//Will enable general call interrupts

In your interrupt code, when I2C_ISR_STATE=0, which signifies that a 'write' has been triggered, or I2C_ISR_STATE=0x80, which is the first transaction on a read, if you look at the value in the SSPBUF register, it will hold the address that matched. So if you test for this being '0', or '1', then these are the 'general call' conditions. This allows you to program different responses (if required), to a general call, from one that matches the programmed address in the device (in SSPADD).

Best Wishes
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