微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > PIC单片机之I2C(从模式)

PIC单片机之I2C(从模式)

时间:05-30 来源:互联网 点击:

nter;

rx_status=false;

Temp=SSP1STAT;

Temp = 0x2D;

if(Temp==0x09)//Write operation,last byte was an address,buffer is full

{

SSP1IF = 0;

i2c_address = SSP1BUF;

timercounter=while_delay;

while(PIR1bits.SSP1IF == 0)

{

timercounter--;

if(timercounter==0)

{

return ;

}

}//waiting for send ~ACK

SSP1IF = 0;

word_address = SSP1BUF;

return ;

}

if(Temp==0x29)//Write operation,last byte was data,buffer is full

{

SSP1IF=0;

Register[word_address]=SSP1BUF;

word_address++;

if(word_address>=RX_BUF_LEN)

{

word_address=0;

}

}

}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top