27,370
社区成员
发帖
与我相关
我的任务
分享
/*往 AT24C1024指定地址读一个字节
*/
void read_8bit(unsigned char *ch)
{
unsigned char i;
unsigned char temp=0x80;
*ch=0x00;
SCL=0;
for(i=0;i<8;i++)
{
SDA=1; //SDA=1这语句在这里有什么用呢。我去掉后程序照样正常运行。
SCL=1; //上拉SCL读数据
iic_delay();
if(SDA)
*ch|=temp;
temp >>= 1;
SCL=0;
iic_delay();
}
}