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 CCS Technical Support

#int_ssp not work

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



Joined: 06 Apr 2009
Posts: 5

View user's profile Send private message

#int_ssp not work
PostPosted: Fri Oct 16, 2009 4:44 pm     Reply with quote

Hello All

I have two Pic microcontrollers 18F2550.
I use I2C (One PIC master and one PIC slave).
My problem is the #int_ssp not work.

MASTER:
Code:

#use i2c(master, SDA=PIN_B0, SCL=PIN_B1, address=0x01)
#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7,STREAM=PC)

#INT_SSP
void i2c_isr()
{
 printf("\n\r&&&&&&&&&&& enter master interrupt &&&&&&&&&&&&\n\r");
}


void main ()
{
  enable_interrupts(GLOBAL);
  enable_interrupts(INT_SSP);

for(;;) {      
        i2c_start();
        i2c_write(0x02);
        i2c_write('a');
        i2c_stop();
      }


SLAVE:
Code:

#use i2c(SLAVE, SDA=PIN_B0, SCL=PIN_B1, address=0x02,)
#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7,STREAM=PC)

BYTE  state;
unsigned char i =0;

#int_ssp
void i2c_isr()
{
   printf("\n\r********Enter interrupt************\n\r");
   state = i2c_isr_state();
   printf("++++++++++++State = %x+++++++++++++++++++++++++\n\r",state);

 
}



void main ()
{

enable_interrupts(GLOBAL);
   enable_interrupts(int_ssp);
     
    
   for(;;){ }

}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Oct 16, 2009 5:05 pm     Reply with quote

Look at these threads for sample code for an i2c slave:
http://www.ccsinfo.com/forum/viewtopic.php?t=39565&start=4
http://www.ccsinfo.com/forum/viewtopic.php?t=39242&start=6
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