如何用单片机制作简易版万年历?
多功能电子时钟Deendown Cloud云下偏差DIFDOWN多功能时钟的clouddown dentdown dentdown dentdown dentdown dentdown dentown dentown dentown dentown dentown dentown dentown dentown dentown dentown dentown dentown。数字管可以通过单击按钮来显示日期和时间。
2 这是个好主意。
设置警报时间。
3 你是个好主意。
它具有秒表功能。
4 它具有倒计时功能。
5 注意小时的时间。
蜂鸣器将在一小时内响起相关频率的数量。
6 在判断两年并设定日期时,请遵循本月的常规规模和常规法律。
仿真过程如下:1 2 显示当前时间,按“设置”按钮输入设置模式。
光指数将很轻。
3 你是个好主意。
时钟,单击设置键以调整几分钟和秒。
指示设置完成的时间。
4 一年,单击日期按钮以切换到实际日期显示以显示一个月和一天。
5 单击设置键以设置第一年。
一年来表明谈判的调整。
然后与定义一个月并设置一个月相同。
6 单击设置按钮以在设置日期后退出设置模式。
7 单击“警报”按钮输入警报模式。
通常的时间是1 6 :3 0。
修改警报时间,然后按设置键。
是时候指示指示时间的时间,单击设置以显示下一个设置以描述时间。
8 您想度过美好的时光吗? 单击“警报”按钮显示秒表指示灯,停止秒表单击状态页面以开始,然后显示停止时间表的时间。
9 单击“重置键”。
秒表时间登录为0。
单击statch按钮打开倒计时模式。
单击状态按钮以启动Courddowd。
1 1 按重新启动键。
使用KEIL4 或KEIL5 编译器的程序代码。
Compeition配备了方便的理解。
该程序是通过广告软件设计的,供实际参考。
原生物模拟与真实对象之间的差异:1 访问环境 - 模拟在计算机上起作用。
2 这是个好主意。
调试方法:您可以轻松地通过仿真进行,并且需要实际对象才能退出调试器或串行端口。
3 你是个好主意。
电路连接方法:通过软件设置修改仿真,实际对象通过硬件电路板和连接电缆。
4 速度速度:模拟通常比实际限制更快。
5 工作实现 - 通过综合软件设置了解模拟,并了解电路设计和设备性能中的实际对象。
介绍设计报告,软件设计,软件和硬件,调试,简短和前景详细信息。
设计数据;程序代码,程序代码,业务计算,设计下载链接:docs.qqqq/doc/ds0nstw
求基于51单片机P01,P2 LED接数码管,用三极管驱动的电子时钟程序,大神求救啊!
程序名称:5 1 微控制器数字管电子装配程序n:jian gx.net ********************************************************************************************************************** 确定尺寸按钮的键。开始:movtmod,#01 H; 计时器0,操作模式1 MOVTH0,#03 CH MOVTL0,#0B0H; VR6 ,#0; 0。
带有一个节拍的寄存器在MOV2 5 H,0。
十个位寄存器以MOV2 5 H,0。
LJMPDISPLAYTIMER_0:CLREA INGR6 INGR5 MOVTH0,#03 CH MOVTL0,#0B0H; E:CJNER6 ,#2 0,出口; 位是6 ,纯MOV2 1 H,#00H inc2 2 h min:Mova,2 2 H CJNEA,#1 0,出口; 如果一点点为1 0,则纯MOV2 2 H,#00h inc2 3 h mova,2 3 h cjnea,#6 ,出口; 如果十位等于6 ,则纯MOV2 3 H,#6 ,#00h inc2 4 h小时:Mova,2 5 H CJNEA,#2 ,Loop; 如果十位数字是2 位,则MOVA,2 4 H CJNEA,#4 ,输出来检查明确的数字; 如果明确的数字为4 ,则透明的MOV2 4 H,#00H; PEXIT循环:Mova,2 4 H CJNEA,#1 0,出口; 如果明确的数字为1 0,则清除MOV2 4 H,#00h inc2 5 h ljmpexit输出:ljmpdisplay; Mova,2 0h movca,@a+dptr movp0,clrp2 .7 lcalldelay setbp2 .7 ; 十位数字MOVA,#0BFH MOVP0,CLRP2 .5 LCALLDELAY SETBP2 .5 ; 3 H movca,@a+dptr movp0,clrp2 .3 lcalldelay setbp2 .3 ; a+dptr movp0,clrp2 .1 lcalldelay setbp2 .1 ; 显示MOVDPTR时,#table1 ; Table1 使用此位来消除Pre-0 Mova,2 5 H Movca,@A+DPTR MOVP0,CLRP2 .0 LCALLDEL AY SETBP2 .0; 4 H; B0C0H,0F9 H,0A4 H,0B0H,9 9 H,9 2 H,8 2 H,0F8 H,8 0H,9 0H; 字体显示。
table1 :db0ffh,0f9 h,0a4 h,0b0h,9 9 h,9 2 h,8 2 h,0f8 h,8 0h,8 0h,9 0h; nd;
利用单片机的定时器和数码管,设计一个电子时钟
我将为您提供电路和程序,//几天前,我将写信给一个网络,即微控制器的时间时钟正在调整函数,您可以参考我的程序 /*•••****** /•******** / ************************************** // 4 SBITSHUG_05 数字管= P2 ^4 ; //数字管5 SBITSHUG_06 = P2 ^5 ; //锁定菜单#dendeled_datap1 //数据端口p1 unsignedCharvalue_temp = 0; unsigncharvalue_outk = 0; unsignedCharvalue_shio = 8 ; B0.0x9 9 ,0x9 2 ,0x8 2 ,0xf8 ,0x8 0,0x9 0}; //公共阳极unosignedCodeValue_tab1 [] = {0x4 0,0x7 9 ,0x2 4 ,0x3 0,0x1 9 .0x1 2 ,0x02 ,0x7 8 ,0x00,0x1 0}; //带有点/**的流行阳极延迟延迟1 ms子函数**/voiddelay_1 ms(unsignInttime){unsignIntx,y; ]子函数**/voiddisp_layledketcmd(void){/***小时***/shug_01 = 1 ; LED_DATA = value_tab0 [value_shio/1 0]; UG_02 = 1 ; LED_DATA = value_tab1 [value_shio%1 0];/******/1 0];/******); shug_04 = 0;/*******/shug_05 = 1 ; AB0 [value_miao%1 0];/ **********在几秒钟内显示数字******/ r0 = 1 ; y_1 ms(1 0); if(key0_02 == 0){value_miao-; if(value_miao == -1 ){value_feno-; value_miao = 5 9 ; if(value_feno == -1 ){value_shio-; -1 ){value_shio = 2 3 ;}}} while(key0_02 == 0);}} if(key0_03 == 0){delays_1 ms(1 0); if(key0_03 == 0){value_miao ++; if(value_miao == 6 0)_feno == 6 0){value_feno = 0; value_shio ++; if(value_shio == 2 4 ){value_shio = 0;}}} while(key0_03 == 0); ; while(1 ){scan_keoutcmd(); disp_layledketcmd(); //应用程序程序的实现}}}/**时间-Shut -off服务程序**/voidtmero()iao == 6 0){value_feno ++; value_miao = 0; if(value_feno == 6 0){value_shio ++; value_feno = 0; if(value_shio == 2 4 ){value_shio = 0;急求一个用51单片机编的可按键调时的数字时钟程序,数码管显示,C语言编写,谢谢。
#include当lcd-busy为0时,开始编写命令rs = 0; rw = 0; ep = 0; _nop _(); _ nop _(); p0 = cm d; _nop _(); _ nop _(); _ nop _(); _ nop _() ep = 1 ; _nop _(); _ nop _(); _ nop _(); _ nop_(); ep = 0;} //将数据写入lcdvoidlcd_wdat(chardat){while(lcd_busy()); //当lcd_busy为1 时,再次检测LCD繁忙状态。
当lcd-busy为0时,开始编写数据rs = 1 ; rw = 0; ep = 0; p0 = dat; _nop _(); _ nop _(); _ nop _(); _ nop_(); _ nop _(); ep = 1 ; _nop _(); _ nop _(); _ nop _(); _ nop_(); EP = 0;} // LCD数据指针位置程序voidlcd_pos(charpos){lcd_wcmd(pos | 0x8 0); //数据指针= 8 0+地址代码(00h〜2 7 H 〜6 7 H)} // characters)// Here we set to place one custom character in 0x00 position (000) and the other in 0x01 bit (001 ) voidlcd_sef_chr(){//The first custom character lcd_wcmd(0x4 0);//The address of the first line of "01 0000000" (D7 D6 is the address set The command form D5 D4 D3 is the character storage position (0--7 ), D2 D1 D0是字符行地址(0--7 ))LCD_WDAT(0x1 F); // //“ XXX1 1 1 1 1 1 ”行1 数据(D7 D6 D5 是XXX,表示为任何数字(通常为000),D4 D3 D2 D1 D0是字符线数据(1 -lit,0-off)lcd_wcd_wcmd(1 -off)lcd_wcmd(1 -off)lcd 0000 000 000 000 000 000 000 000 000 000; lcd_wdat(0 x1 1 ); //“ xxx1 0001 ”第二行数据lcd_wcmd(0x4 2 ); // //“ 01 00001 0”第三行地址lcd_wdat(0x1 5 ); //“ xxxx1 01 01 ”第三行数据LCD_WCMD(0x4 3 ) lcd_wdat(0x1 1 ); //“ xxx1 0001 ”第四行数据lcd_wcmd(0x4 4 ); // //“ 01 000 1 00”行5 地址lcd_wdat(0x1 f); // // lcd_wdat(0x0a); //“ xxx01 01 0”第6 行数据lcd_wcmd(0x4 6 ); // //“ 01 0001 1 0”第7 行7 地址LCD_WDAT(0x1 F); // //第8 行地址LCD_WDAT(0x00); //“ XXX00000”第8 行数据//第二个自定义字符lcd_wcmd(0x4 8 ); //“ 01 001 000”行1 地址1 地址lcd_wdat(0x01 ) lcd_wdat(0x1 b); //“ xxx1 1 01 1 ”第二行数据lcd_wcmd(0x4 a); // //“ 01 001 01 0”第三行地址lcd_wdat(0x1 d); // // lcd_wdat(0x1 9 ); //“ xxx1 1 001 ”第四行数据lcd_wcmd(0x4 c); // //“ 01 001 1 00”第五行地址lcd_wda t(0x1 d); // // lcd_wdat(0x1 b); //“ xxx1 1 01 1 ”第6 行数据lcd_wcmd(0x4 e); // //“ 01 001 1 1 0”第7 行7 地址lcd_wdat(0x01 ); // // at(0x00);//"XXX00000" line 8 data}// LCD initialization setting voidlcd_init(){lcd_wcmd(0x3 8 );// Set LCD to 1 6 X2 display, 5 X7 dot matrix, eight-bit data excuse delay(1 );lcd_wcmd(0x0c);// LCD display and cursor setting (cursor does not flash, "-" does not display) delay(1 );lcd_wcmd(0x06 );// LCD display cursor movement settings (cursor address pointer plus 1 , the whole screen display does not move) delay(1 );lcd_wcmd(0x01 );//Clear the LCD display content delay(1 );}// Calculation of leap year bitleap_year(){bitleap; if(((eNem%4 == 0 && eart%1 00!= 0)|| ey ear; ey ear; eart; proc(){unsignedCharnum_leap; unsignedCharc; num_leap = Year/4 年/1 00+年/4 00; // // //自2 000年以来每年经历的leap年数(leap_year()&& umpor()&&月<= 2 ) 7 ; //计算相应的周returnweek;} //更新显示显示缓冲区voidupdate_disbuf(unsignedchart1 ,unsignedchart2 [],unsignedchardis_h,unsignedchardis_m,unsignedchardis_m,unsignedchardis_s_s) dis_buf1 [2 ] = 5 0; // '2 'dis_buf1 [3 ] = 4 8 ; //'0'dis_buf1 [4 ] =年/1 0+4 8 ; dis_buf1 [5 ] =年= Year%1 0+4 8 ; dis_buf1 [6 ] = 0x2 d; dis_buf1 [dis_buf1 [ 7 ] =月/1 0+4 8 ; dis_buf1 [8 ] =月%1 0+4 8 ; dis_buf1 [9 ] = 0x2 d; //' - 'dis_buf1 [1 0] = date/1 0+4 8 ; dis_buf1 [1 1 ] = date%1 0+4 8 ; dis_buf1 [1 2 ] = 0x2 0; dis_buf1 [1 3 ] = dis_week [4 *week]; dis_buf1 [1 4 ] = dis_week [4 *Week+1 ]; dis _buf1 [1 5 ] = dis_week [4 *Week+2 ]; dis_buf2 [0] = T2 [0]; dis_buf2 [1 ] = t2 [1 ]; dis_buf2 [2 ] = t2 [2 ]; dis_buf2 [3 ] = t 2 [3 ]; dis_buf2 [4 ] = t2 [4 ]; dis_buf2 [5 ] = t2 [5 ]; dis_buf2 [6 ] = t2 [6 ] = t2 [6 ]; //空间if(armard)dis_buf2 [7 ] = 0x01 ; // smace peemangot peemand peemand peemand peemand peemand peemand peaugeot clays pearge offercement(section pecungot exprience)exraige emaive emers_buf2 [7 ] = 7 ] = 7 ] = 7 ] = 7 ] 启用peugeot dis_buf2 [8 ] = dis_h/1 0+4 8 ; dis_buf2 [9 ] = dis_h%1 0+4 8 ; dis_buf2 [1 0] = 0x3 a; //':'dis_buf2 [1 1 ] = dis_m/1 0+4 8 ; dis_buf2 [1 2 ] = dis_m% 1 0+4 8 ; dis_buf2 [1 3 ] = 0x3 a; dis_buf2 [1 4 ] = dis_s/1 0+4 8 ; dis_buf2 [1 5 ] = dis_s%1 0+4 8 ;} //时间 和日期处理程序voidpro_timedate(){sec ++; if(sec>5 9 ){sec=0;min++;if(min>5 9 ){min=0;hour++;if(hour>2 3 ){hour=0;date++;if(month==1 ||month==3 ||month==5 ||month==7 ||month==8 ||month==1 0||month==1 2 )if(date>3 1 ){date=1 ;month++;}//The 3 1 st day of 如果(月= 4 ||月== 6 ||月== 9 ||月== 1 1 )if(日期> 3 0){date = 1 ; node ++;} // 3 0天的月份为if(note == 2 ){if(leap_year()// leap yeak =(lap_year()if(date> 2 9 )ep = 1 ; else {if(date> 2 8 ){date = 1 ;月++;}} // leap年的二月为2 8 天} if((月> 1 2 ){月= 1 ; year ++;} if(y> 9 9 )年= 0;}}}}}}}}}}}}}} week_proc() 闹钟已启用,闹钟时间已启动,启动timer1 }} //显示处理程序voidpro_display(){unsignedChari; lcd_pos(0 x00); for(i = 0; i <= 1 5 ; i ++){lcd_wdat(dis_buf1 [i]);} lcd_pos(0x4 0); for(i = 0; i = 1 ; i <= 1 5 ; i ++){lcd_wdat(lcd_wdat(lcd_buf2 [i]) voidTimer0()中断1 {th0 = 0xd8 ; tl0 = 0xf0; sec1 00 ++; if(sec1 00> = 1 00)// 1 次// 1 次(1 00*1 0ms = 1 000ms = 1 000ms = 1 s){sec1 00 = 0; pro_timedate() 第二个update_disbuf(0x00,“”,小时,最小,sec); // 0x00代表显示00位置的自定义字符Elseupdate_disbuf(0x00,“ richmcu”,hour,min,se c); pro_display(); // //调用显示处理函数} //键scanner unsignedcharscancan_keykekey() skey = skey << 1 ; //保存b1 位键| = sek | seet | seet; //读取设定键的状态并存在于skey的b0 bit returnskey中; //返回skey(| pre )的密钥值(处理,set状态)} //外部int0 int0 int0 int int int int int int int int int int int int int rempent int int int int int int int int rempt int int rempent int int rempt voidint0 eirn 0 = 0; // lcd_wcmd(0x0e); //显示光标“ _”,整个光标均未闪烁警报= 1 ; UPDATE_DISBUF(0x5 0,“警报:”,Armhour,Armin,Armec); //更新显示数据,0 X5 0表示显示“ P” pro_display(); // //调用显示器lcd_pos(0x4 7 ); //在第一个调整项目标志下设置Cursor; // while(flag^0x0a){skey=scan_key();//Scan the key state if(skey^vkey)//If skey is the same as vkey, the loop will be jumped out, and the loop body is executed differently {delay(1 0);//Remove the key shaking skey=scan_key();//Return back to the scanning key state if(skey^vkey)//If skey is the same 作为vkey,跳出循环并执行循环体的执行方式有所不同{vkey = skey; //向vkeyif(skey == 0x01 )// pre 键按键按{flag ++; //调整flag ++; //调整标志位置加1 switch(flag)//在相应的调整位置{case1 :lcd_pos(curs curs eark earter); lcd_pos(0x4 9 ) case2 :lcd_pos(0x4 c); break; // cursor设置微小的警报设置位置案例3 :lcd_pos(0x4 f); break; //游标设置第二个警报设置case4 :update_disbuf(update_disbuf(0x5 0,“ time:time:”时间: case4 :update_disbuf(0x5 0,“时间:”,小时,min,sec); pro_display(); lcd_pos(0x05 ); break; // cursor年度调整位置案例5 :lcd_pos(lcd_pos(0x08 ); break;/break;/reaks; // cursor set Mather curs set cursly notel curs seT curs seT curs seT curs inthly curs inter seT curs case6 :lcd _ breacs/curer/curer/breacs/breacs/breacs/x 0x0b; case7 :lcd_pos(0x4 9 );break;//Cursor set daily adjustment position case8 :lcd_pos(0x4 c);break;//Cursor set points adjustment position case9 :lcd_pos(0x4 f);break;//Optical Set the second adjustment position default:break;}}if(skey==0x02 )//SET key pre ss {pro_key();//Turn the key to set the key handler}}}}}lcd_wcmd(0x0c);//Set the LCD display and the cursor does not flash, and does not display "-"lcd_wcmd(0x01 );//Clear the LCD display content IE=0x8 f;//CPU interrupt, INT0, INT1 , interrupt TR0=1 ;//Timer 0 Start}// Main program, initialization and initial value setting voidmain(){lcd_init();// Initialization LCDlcd_sef_chr();// Write custom characters hour=0;min=0;sec=0;// When on power, minute and second display armhour=0;armmin=0;armsec=0;// When on power, minute and second alarm initial value year=5 ;month=1 ;date=1 ;// Year, month, month, Sunday and week display week_proc();alarm=1 ;//Initial power-on, enable alarm clock IE=0x8 f;//CPU switch interrupt, INT0, INT1 , Timer0, Timer1 switch interrupt IP=0x04 ;//Set INT0 as the highest priority of interrupt IT0=0;IT1 =0;//Output INT0, INT1 is 将设置为级别触发模式(请注意,不应选择触发器,因为很容易导致错误)tmod = 0x1 1 ; // Timer0,Timer 1 在模式1 ,1 6 位定时模式TH0 = 0xDC; tl0 = 0x00 = 0x00; // TIMER0设置1 0ms TIMING TH1 = 0xff; tl1 = 0x的初始值; tl1 = 0x = 0x00; tl1 = 0x00; tl1 = 0x00; tl1 = 0x00; tl1 = 0x00; tl1 = 0x00; tl1 = 0x00; tl1 = 0x00; tl1 = 0x00; tr0 = 1 ; // timer0启动tr1 = 0; while(1 );} //设置密钥处理程序voidpro_key(){switch(flag){case0:armard =!alarm =!alarm; // enable; //启用或关闭闹钟时钟(al)ARM = 1 :ENABL lcd_pos(0x4 7 );休息; //光标返回到原始调整位置案例1 :armhour ++; if(armhour> 2 3 )armhour = 0; update_ disbuf(0x5 0,0x5 0,“ armart:”,armhour,armhour,armin,armin,armec); //更新显示pro_display()clays corplay() 返回原始调整位置案例2 :Armin ++; 如果(Armin> 5 9 )Armin = 0; update_disbuf(0x5 0,“警报:”,Armhour,a RMMIN,ARMEC); PRO_DISPLAY(); LCD_POS(0x4 C); break; case3 :Armsec ++; if(armpec> 5 9 )Armsec = 0; update_disbuf(0x5 0,“ armart:“ armard:“ armar:”,armhour,armhour,armmin,armmin,armmec); pro_display(pro_display(); lcd_pos; lcd_pos; ++;如果(> 9 9 )年= 0; week_proc(); //自动计算工作日update_disbuf(0x5 0,“时间:”,“时间:”,小时,min,sec); pro_display(); lcd_pos(lcd_pos(0x05 )(0x05 )(0x05 ); bream; case5 :case5 :case5 :case5 :> 1 2 :> 1 2 :> 1 2 ; if(> 1 2 ) sbuf(0x5 0,“时间:”,小时,最小,sec); pro_display(); lcd_pos(0x08 ); break; break; case6 :date ++; if(月== 1 || 1 || ||月== 3 ||月== 5 ||月度== 5 ||月== 5 ||月== 7 || 7 ||月== 8 ||月== 1 0 | | | | | | | | | | 3 1 | 3 1 if(3 1 da) f(月== 4 ||月== 6 ||月== 9 ||月== 1 1 )如果(日期> 3 0)date = 1 ; //小月有3 0天,如果(月== 2 ){if(leap_year())// leap年的条件{if(date>>>>>>>> 2 9 )lap = 1 ; 年是2 8 天Week_proc(); //自动计算 update_disbuf(0x5 0,“时间:”,小时,min,sec); pro_display(); lcd_pos(0x0b); break; break; case7 :hour ++; if(hour> 2 3 )hour = 0; update_disbuf(update_disbuf) pos(0x4 9 ); break; case8 :min ++; if(min> 5 9 )min = 0; update_disbuf(0x5 0,“时间:”,小时,min,sec); pro_display(); lcd_pos(0x4 c); case9 :case9 :sec+sec+sec+sec+sec> 5 9 ) ,“时间:”,小时,min,sec); pro_display(); lcd_pos(0x4 f); break; break; extault:break;}} // timer1 中断处理程序,生成一个警报声音voidTimer1 (voidTimer1 ( voidint1 ()interrupt2 {if(TR1 )TR1 =0;} Experimental description: Press K1 to enter the setting state, pre ss K2 , enter the setting of alarm clock function, minute, second, year, month, day and time, minute, second, until exit the setting state, pre ss K3 , adjust whether to use alarm clock and adjust alarm clock, minute, second, year, month, day, time, hour, minute, second, second digital LCD second row Display the small speaker, 指示启用了闹钟函数。
如果没有,则禁止闹钟功能(可以在调整状态下设置)是正常的。
自定义字符显示在LCD行的前部,“ RichMCU”在LCD行的前面闪烁,“ P”显示在LCD行的前面,“警报:”在设置警报时间时在LCD行的前面显示,并且在“ 2 000年”时显示了其他状态,其他状态则显示出其他状态。
预计本周的自动转换将被采用。
谢谢你~~