利用模拟I2C读写PCF8563中的时间,读时间总是读出一个错误的固定值;查看状态寄存器1中的值为0xff;在初始化函数中,先关闭了芯片,设置初始时间(顺带读取设置的时间,读出的时间是固定值,而不是设置好的初始时间),在往状态寄存器1中写0x00运行芯片,初始化后,查看状态寄存器1中的值还是为0xff;我就感觉我写数据就没有写进去,有人可以帮帮我嘛?下面是我的初始化函数,没有配置中断。 |
WriteClockPara(0x00, 0x20); //关闭芯片
WriteClockPara(8,0x22); //写年
Calendar.Year = ReadClockPara(8,0x00ff);//读年
WriteClockPara(7,0x8A);//写月
Calendar.Month = ReadClockPara(7,0x001f);//读月
WriteClockPara(5,0x28);//写日
Calendar.Dat = ReadClockPara(5,0x003f);//读日
WriteClockPara(4,0x15);//写时
Calendar.Hour = ReadClockPara(4,0x003f);//读时
WriteClockPara(3,0x46);//写分
Calendar.Min = ReadClockPara(3,0x007f);//读分
WriteClockPara(2,0x00);//写秒
Calendar.Sec = ReadClockPara(2,0x007f);//读秒
WriteClockPara(0x00, 0x00); //运行芯片
T_I2CDelay();
}