基于单片机AT89C51控制的电子时钟课题设计报告 下载本文

C3R91k22uFRSTR101k

3.3 四位一体数码管显示

vcc90129012Q29012Q39012Q4R1R2R3R4R5R6R7R8Q14.7kJ2U11234567891011121314151617181920P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7RESETRXDTXDINT0INT1T0T1WRRDXTAL2XTAL1GND8751VCCP0.0P0.1P0.2P0.3P0.4P0.5P0.6P0.7EA/VPALE/PPSENP2.7P2.6P2.5P2.4P2.3P2.2P2.1P2.04039383736353433323130292827262524232221R9R10R11R12R13R14R15R16100100100100100100100100四位数码管abcdefdgpJ11234CON4R22R21R20R194.7K4.7K4.7K4.7K1234 4 软件设计

4.1 主程序流程图

开始 初始化

功能键 4.2正常计时 Y y初始化 N 调节时间 LED显示 结束 void csh(void) {

TMOD=0X11; TH0=0XF8; TL0=0X30; smg=0xff; EA=1; ET0=1; minute=0; minute1=0; TH1=0xd8; TL1=0xf0; TR1=1; ET1=1; lsd_4=1;

4.3 数码管显示

void smgxs(void) {

if(xtw==1) {

xt_en4=1; smg=smgxsm[qw];

}

xt_en1=0;

if(xtw==2) { } if(xtw==3) { }

xt_en2=1; smg=smgxsm[sw]; xt_en3=0; xt_en1=1;

smg1=smgxsm[bw]; if(dp_en==1) { } else { } xt_en2=0; smg=smg1; smg=smg1&0x7f;