Just to give you and Idea on what it takes to make this module to roll data out without a problem in Poll mode.
I am using some software semaphores so the code may not be easily portable but I am sharing this code so that you get to see some of what works. This is the same module as the one you are using the bit names have a small modification but it should be simple to make sense of the names. I left most of my comments in the code and I hope they help,. 10K pull up values are going to give you problems. I go for 5Ks if I were you.
I avoid do, while statements as they generate brclr/sets and those instructions tend to get stuck depending on the condition required. I always like the routine to return and error code and exit.
Regards,
Ed
//*****************************************************************//
//Inputs: char ID,char Read_Write,char NumberBytes
//Outputs: IIC_Accepted
// Calling format : ack_flag=Send_IIC_Address(Control1,RW1,Total_Bytes)
//*****************************************************************//
char Send_IIC_Address(char ID,char Read_Write,char NumberBytes)
{
char IIC_Accepted;
IIC_Accepted=0;
if(Slave_Flag==0)// if driver intends to be in Master mode
{
IBIF=1;
TX_RX_=1; // from master to slave
MS_SL_=1; // send START on clean slate
}
ID=ID<<1;
if(MS_SL_==1 && TX_RX_==1)
{
IIC_Delay(1000000);//spacing between start and char.
// should not be needed to ensure byte reception
// continuity.
if(Packet_Status==0)//
{
IIC_DATA_ARRAY[0]=NumberBytes;
IIC_Byte_Counter=0;
Send(ID | Read_Write);
}
//IBDR=ID | Read_Write;// or the SRW bit with Address ID.
//IIC_Delay(100);// worked polled at 900 at 968usec from end of last to begin of next.
// worked polled at 500 at 59usec from ID to first byte.
if(RXAK==0)
{
IIC_Accepted=PORTB;
IIC_Accepted=IIC_Accepted & 0xF7;
PORTB=IIC_Accepted;// Turn on LED4 to indicate packet is transfer.
if(Read_Write==1)
Slave_Flag=0;// master mode
IIC_Accepted=1;//Everything is cool let's get running
// Packet_Status=1; // handled in the interrupt when polled here
}
else
MS_SL_=0;// sending stop
}
else
{
IBEN=0;
IBEN=1;// Bus is gone crazy
MS_SL_=1;// sending START
}
return IIC_Accepted;// if char =0 no response from slave node.
}
**************************************************************************************************************
//Description. Send packet will send a series of packets with
//incremental data n to n-1 where n-1=Number_Bytes-1 bytes.
char Send_Packet_Polled(char Number_Bytes)
{// send
char Byte_Counter=0;
char error_flag;
char Return_Val=0;
char Number_Fail=0;
char Number_Pass=0;
char chase_flag=1;
while(chase_flag==1)
{
Return_Val=Send_IIC_Address(0x0E,0,4);//wp0xe
if (Return_Val==1)// good case.
{
Number_Pass++;
chase_flag=false;
}else
{
Number_Fail++;
Byte_Counter=0;
return Byte_Counter;// Returns Number_Bytes-1 as completion flag
}
}// end of while char_flag
for (Byte_Counter=0;Byte_Counter<=Number_Bytes

{
// working with 7 but no second packet was moved to else.
if(IBIF==1)
{
if(RXAK==0)
{
//400 456 uSec works on packet only
//500 568 uSec works
//600 because START always given a macth hard to code
if(MS_SL_==1)
{
if(TX_RX_=1)
{
IIC_Delay(900000);/// could do a while (IBIF==1)
IBDR=Byte_Counter; // to generate brclr instruction.
IIC_Delay(60);//100= 56usec working
// 60=10usec spacing between bytes. Real
Byte_Counter++; // 55=8usec and not working real
// 60 EM does not
// 70 no
// 100
// 200
}
}
else
{
Byte_Counter=Number_Bytes+1;
return Byte_Counter;
}
}// end of else RXAK==0;
if(RXAK==1)
{
error_flag=1;// abnormal condition
Byte_Counter=Number_Bytes+1;
MS_SL_=0;// send stop
IBIE=0;
TX_RX_=1;
return Byte_Counter;// Returns Number_Bytes-1 as completion flag
}// end of if no ack from slave
}// end of if(IBIF==1) case.
else
{//
Byte_Counter = Number_Bytes-1;
}// end of if(IBIF==0) case.
// end of good case
if(Byte_Counter == Number_Bytes-1)
{
error_flag=0;//normal condition
Byte_Counter=Number_Bytes+1;// end this loop
MS_SL_=0;// send stop
IBIE=0;
TX_RX_=1;
return Byte_Counter;// Returns Number_Bytes-1 as completion flag
}
}// end of send Number_Bytes polled for loop.
}// end of send Packet Polled.