Jump to content

I2C Master/slave - Slave Not Responding

Recommended Posts

sspcon.CKP = 0;
sspbuf = 22;
sspcon1.WCOL = 0;
sspbuf = 0x22;
sspcon.CKP = 1;

i2c_write(i2c_slave_add | 0x01);	//	write to slave
i2c_write(0x04);	//	write command "Read_Temp"
//wait till sspbuf is full, then read out the data
UART_SendString("  Temp: ");
t_dat = sspbuf;
itoa(sspbuf,buff,10);	//	prepare for uart
UART_Write_Text(buff);	//	send data to uart

I have managed to get a master slave system working (mostly) with a pair of 16F1519 chips. I am certain the I2C is working as I am able to make an LED on the slave turn on/off and blink on command from the master.


I am now trying to have the slave send data back to the master, but I'm not getting anything back. I have tried several arrangements on both the master and slave to get data back, biut nothing yet. Does anyone have a working snippet I can see on how the master sends to get the data and the slave responds to send the data?


My code is below for anyone who wants to try their luck at deciphering my madness. Still not sure why the code always gets stuck at the top of this.



Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...