case IICA_SEND_DATA_ADDR_STATE:
STT0 = 1; //generate the start condition again
while (wait--); //wait a short time for the generation of start condition
IICA0 = IICA_Para.slaveAddr | 0x01;
WTIM0 = 0; //the master will genterate the interrupt at the falling edge of eighth clock
ACKE0 = 1 //enable to send ACK
IICA_Para.state = IICA_RECIEVE_DATA_STATE;
break;
case IICA_RECEIVE_DATA_STATE:
*IICA_Para.pbuffer++ = IICA0;
if (--IICA_Para.number == 0)
{
ACKE0 = 0; //the last data send the NACK. Note that the ackownlege signal is not sent untile the SCL line is released
WTIM0 = 1; //master will generate interrupt at the falling edge of the ninth clock pulse
IICA_Para.state = IICA_STOP_STATE;
} //at this time when receiving the last data, the ackownlege singal is not sent from master
WREL0 = 1; //release the SCL; Note that the master will pull down the clock after entering ingterrupt
break;