问答

汇集网友智慧,解决技术难题

Wbhdpj

TA的家园币:23  

  • 关于芯圣HC89F3XX1使用8M晶振误差问题

    最近在使用HC89F3541的外部时钟,晶振使用8M规格书误差为20PPM,实测29小时误差约为0.015%。麻烦各位大佬看看,那里能改进。下面为初始化配置:(IO口初始化略....)WDTC|=0x10;CLKCON|=0x04;//外部晶振打开XTALCFG|=0x01;//选择外部高频晶振CLKOUT=0x03;//选择外部时钟xtal_clk输出位CLKSWR=0xf0;//选择外部高频RC为系统时钟CLKDIV=0x01;//1分频//Time0配置TCON=0;TCON1=0x01;TMOD=0x00;TH0=0xFC;//125usTL0=0x18;ET0=1;TR0=1;voidTIMER0_Rpt(void)interruptTIMER0_VECTOR{if(++R_u8add10ms>=80)//10ms{R_u8add10ms=0;if(++R_u8Input_1s>=100){R_u8Input_1s=0;if(++R_BeijingTimeS>=60){R_BeijingTimeS=0;R_BeijingTimeM++;if(R_BeijingTimeM>=60){R_BeijingTimeM=0;R_BeijingTimeH++;if(R_BeijingTimeH>=24){R_BeijingTimeH=0;R_BeijingWeek++;if(R_BeijingWeek>7){R_BeijingWeek=1;}}}}}}}