下面是主函数
void main(void)
{
//init ds3231
Ds3231_init();
Ds3231_Set_Time(11,8,6,9,10,20); Uart0_SendStr("\nSystem time set OK.\n");
while(1)
{
I2C_Start(); Uart0_SendStr("\nControl Register="); Uart0_SendStr(num2Str2(I2C_Read_byte(0x0e,0))); Uart0_SendStr("\nStatus Register="); Uart0_SendStr(num2Str2(I2C_Read_byte(0x0f,0)));
Uart0_SendStr("\nYear="); Uart0_SendStr(num2Str2(I2C_Read_byte(0x06,0))); Uart0_SendStr(",Month="); Uart0_SendStr(num2Str2(I2C_Read_byte(0x05,0))); Uart0_SendStr(",day="); Uart0_SendStr(num2Str2(I2C_Read_byte(0x04,0))); Uart0_SendStr(",Hour="); Uart0_SendStr(num2Str2(I2C_Read_byte(0x02,0))); Uart0_SendStr(",Minute="); Uart0_SendStr(num2Str2(I2C_Read_byte(0x01,0))); Uart0_SendStr(",Second="); Uart0_SendStr(num2Str2(I2C_Read_byte(0x00,1))); Uart0_Send('\n');
I2C_Stop();
}
}
[ 本帖最后由 doleph 于 2011-8-7 11:13 编辑 ]