旋转的led时钟图文精Word文档格式.docx
- 文档编号:20887713
- 上传时间:2023-01-26
- 格式:DOCX
- 页数:8
- 大小:59.96KB
旋转的led时钟图文精Word文档格式.docx
《旋转的led时钟图文精Word文档格式.docx》由会员分享,可在线阅读,更多相关《旋转的led时钟图文精Word文档格式.docx(8页珍藏版)》请在冰豆网上搜索。
,最外侧的发光二极管就点亮一个瞬间一呈现时间刻度。
这样,如果在0.1s内这列发光二极管能旋转完一圈,则人眼就会产生错觉,而把先后产生的时间刻度连成12个完整的时间刻度。
明确系统功能
系统的功能比较清楚:
电机带动一系列发光二极管绕轴旋转,单片机控制发光二极管在旋转过程中的相应位置上点亮以指示时间和刻度,与此同时,单片机内部进行时钟的计时操作,以控制旋转时钟显示正确的走时。
这种利用机械的带动分时显示数据信息的方法叫做机械扫描显示。
硬件设计
旋转时钟主要有两部分组成:
电机部分和单片机控制发光二极管显示部分,在单片
本制作品用51单片机控制,具体电路原理图如下:
软件编程
因学的是C51(不懂汇编)这里只提供C语言源程序,并限制为无遥控功能。
也可提供带遥控功能的hex文件。
#include
sbitgate11=P3^0;
sbitgate12=P3^1;
#defineunitunsignedint
#defineucharunsignedchar
uchardataBUFFER[]={0,0,0,0,1,1,7};
uchardataM[]={31,28,31,30,31,30,31,31,30,31,30,31};
ucharcodeNUM1[]=
{
0x80,0x7F,0xC0,0xFF,0x40,0x90,0x40,0x8C,
//-0-
0x40,0x82,0xC0,0xFF,0x80,0x7F,0x00,0x00,
0x00,0x00,0x00,0x81,0x80,0x81,0xC0,0xFF,
//-1-
0xC0,0xFF,0x00,0x80,0x00,0x80,0x00,0x00,
0x80,0xE0,0xC0,0xF0,0x40,0x98,0x40,0x8C,
//-2-
0x40,0x86,0xC0,0xC3,0x80,0xC1,0x00,0x00,
0x80,0x40,0xC0,0xC0,0x40,0x84,0x40,0x84,
//-3-
0x40,0x84,0xC0,0xFF,0x80,0x7B,0x00,0x00,
0x00,0x0C,0x00,0x0E,0x00,0x0B,0x80,0x89,
//-4-
0xC0,0xFF,0xC0,0xFF,0x00,0x88,0x00,0x00,
0xC0,0x47,0xC0,0xC7,0x40,0x84,0x40,0x84,
//-5-
0x40,0x8C,0x40,0xFC,0x40,0x78,0x00,0x00,
0x00,0x7F,0x80,0xFF,0xC0,0x84,0x40,0x84,
//-6-
0x40,0x84,0x00,0xFC,0x00,0x78,0x00,0x00,
0xC0,0x00,0xC0,0x00,0x40,0xF0,0x40,0xF8,
//-7-
0x40,0x0C,0xC0,0x07,0xC0,0x03,0x00,0x00,
0x80,0x7B,0xC0,0xFF,0x40,0x84,0x40,0x84,
//-8-
0x80,0x03,0xC0,0x87,0x40,0x84,0x40,0x84,
//-9-
0x40,0xC4,0xC0,0x7F,0x80,0x3F,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,
//-:
-
0x00,0x63,0x00,0x00,0x00,0x00,0x00,0x00,
};
ucharcodeNUM2[]=
0x00,0x00,0x7f,0x80,0xff,0xc0,0x82,0x40,
0x8c,0x40,0x90,0x40,0xff,0xc0,0x7f,0x80,
0x00,0x00,0x00,0x00,0x20,0x40,0x60,0x40,
0xff,0xc0,0xff,0xc0,0x00,0x40,0x00,0x40,
0x00,0x00,0x41,0xc0,0xc3,0xc0,0x86,0x40,
0x8c,0x40,0x98,0x40,0xf0,0xc0,0x60,0xc0,
0x00,0x00,0x40,0x80,0xc0,0xc0,0x88,0x40,
0x88,0x40,0x88,0x40,0xff,0xc0,0x77,0x80,
0x00,0x00,0x0c,0x00,0x1c,0x00,0x34,0x00,
0x64,0x40,0xff,0xc0,0xff,0xc0,0x04,0x40,
0x00,0x00,0xf8,0x80,0xf8,0xc0,0x88,0x40,
0x88,0x40,0x8c,0x40,0x8f,0xc0,0x87,0x80,
0x00,0x00,0x3f,0x80,0x7f,0xc0,0xc8,0x40,
0x88,0x40,0x88,0x40,0x0f,0xc0,0x07,0x80,
0x00,0x00,0xc0,0x00,0xc0,0x00,0x83,0xc0,
0x87,0xc0,0x8c,0x00,0xf8,0x00,0xf0,0x00,
0x00,0x00,0x77,0x80,0xff,0xc0,0x88,0x40,
0x00,0x00,0x70,0x00,0xf8,0x40,0x88,0x40,
0x88,0x40,0x88,0xc0,0xff,0x80,0x7f,0x00,
0x00,0x00,0x00,0xc0,0x01,0x80,0x03,0x00,
//-/-
0x06,0x00,0x0c,0x00,0x18,0x00,0x30,0x00,
unitdisp1,disp2,key1,key2;
unitii,jj;
uniti,sw,xz;
voidDelay(unitms{
ms=ms*3;
while(--ms;
}
voidnum_led(intkk,inttt
intjj;
for(jj=0;
jj<
8;
jj++{
gate11=key1;
gate12=key2;
P2=~NUM1[kk+jj*2];
P1=~NUM1[kk+1+jj*2];
Delay(20;
P1=0xff;
P2=0xff;
gate11=key2;
gate12=key1;
P2=~NUM2[tt+15-jj*2];
P1=~NUM2[tt+14-jj*2];
}
voiddisplay_clock(void
key1=!
key1;
key2=!
key2;
disp1=BUFFER[3]/10;
disp2=BUFFER[4]-(BUFFER[4]/10*10;
ii=disp1*16;
jj=disp2*16;
num_led(ii,jj;
P2=0xff;
P1=0xff;
Delay(60;
disp1=BUFFER[3]-disp1*10;
disp2=BUFFER[4]/10;
ii=160;
jj=160;
disp1=BUFFER[2]/10;
disp2=BUFFER[5]-(BUFFER[5]/10*10;
disp1=BUFFER[2]-disp1*10;
disp2=BUFFER[5]/10;
disp1=BUFFER[1]/10;
disp2=BUFFER[6]-(BUFFER[6]/10*10;
disp1=BUFFER[1]-disp1*10;
disp2=BUFFER[6]/10;
voidtimer0(void
interrupt1using1
TMOD=0x11;
TH0=-(5000/256;
TL0=-(5000%256;
TR0=1;
BUFFER[0]=BUFFER[0]+1;
if(BUFFER[6]%4==0M[1]=M[1]+1;
if(BUFFER[0]>
201+xz{
BUFFER[0]=0;
BUFFER[1]=BUFFER[1]+1;
if(BUFFER[1]==60{
BUFFER[1]=0;
BUFFER[2]=BUFFER[2]+1;
if(BUFFER[2]==60{
BUFFER[2]=0;
BUFFER[3]=BUFFER[3]+1;
if(BUFFER[3]==24{
BUFFER[3]=0;
BUFFER[4]=BUFFER[4]+1;
if(BUFFER[4]>
M[BUFFER[5]-1]{
BUFFER[4]=1;
BUFFER[5]=BUFFER[5]+1;
if(BUFFER[5]>
12{
BUFFER[5]=1;
BUFFER[6]=BUFFER[6]+1;
if(BUFFER[6]>
99{
BUFFER[6]=0;
M[1]=M[1]-1;
voidintersvr0(void
interrupt0
sw=1;
voidmain(void
xz=8;
key1=1;
key2=0;
EA=1;
IT0=1;
EX0=1;
IT1=1;
ET0=1;
TH0=-5000/256;
TL0=-5000%256;
for(;
;
Delay(10;
if(sw==1{display_clock(;
sw=0;
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 旋转 led 时钟 图文