IRQ端接int1,CS端接P2.7 void StartDs12c887(void) { chRegA = CMD_START_DS12C887; } void InitDs12c887(void) { chRegB = chRegB | MASK_SETB_SET;/* 禁止刷新 */ StartDs12c887(); chRegB=0x52;//允许周期中断,允许更新中断,24小时制 } void int12c887() interrupt 2 using 1 { P27=0; DS12887REGC=chRegC; if (DS12887REGC&0x20==0) { P1=0x0f; } else { P1=0xF0; } P3|=0X08; P27=1; } void main () { P27=0; InitDs12c887(); P27=1; P3=0X08; EX1=1; while(1) { } }
作者:xiaowang 2005-8-23 22:42:00 |