void alarm_flag()//报警标志查询
{
Start_I2c();
pcf8563_SendByte(0xa2);//写
if(getack())
{ Stop_I2c();}
pcf8563_SendByte(0x01);//地址
if(getack())
{Stop_I2c();}
Start_I2c();
pcf8563_SendByte(0xa3);//读
if(getack())
{Stop_I2c();}
_NOP();
alarm_AF=RcvByte();
putack(0);
Stop_I2c();
if((alarm_AF&0x08)==0x08)//报警时间到
{
beel();
LED1();//led1常亮
//*********清报警标志位
Start_I2c();
pcf8563_SendByte(0xa2);
if(getack())
{ Stop_I2c();}
pcf8563_SendByte(0x01);
if(getack())
{ Stop_I2c();}
pcf8563_SendByte(0x02);
if(getack())
{ Stop_I2c();}
Stop_I2c();
}
}
|