发表于 2008-1-14 15:06:57 http://space.**/Upload/Blog/2008/1/14/a35e54f1-3e40-4bd0-a82c-d9877efcb3fe.jpg 在网上看到不少老外做的各种旋转LED显示屏,非常COOL,我也动手用洞洞板试做了一个类似的显示屏,结果感觉还不错。于是再接再励继续努力,将作品进一步改进,完善后制成如今这个样子。 由于刚学51单片机,加上制作电路板软件也是从零开始,的确花了我不少的时间和精力。不过也就是在这艰难的独立制作中,真正学到了不少实在的东西。 本项目的关键是如何解决高速旋转的电路板如何供电,如何调时的问题。我采用电机电刷的原理,将旋转轴钻空,通过一只插头将电源的从反面引到前面的电路板上,而这个旋转的插头又与固定在背板上的两个铜片接触的。调时的问题有些困难,一是让电路板在旋转前与PC机相接,由电脑传送调时数据,这虽然可行但不方便。还有就是用遥控方法,但此方案在调试方面有很大的困难。 显示方式上,我采用平衡式的两排LED,这除了在旋转时能较好的保持平衡外,主要能利用两边交替显示方式,比单排要快一倍。 本装置不仅是一个时钟,它还可以动态显示汉字及图案,这就看如何发挥了。 其具体制作过程如下: 一。旋转电机的制作 从制作成本与方便考虑,选用旧电脑用的大软驱上的直流无刷电机,只是对局部进行改造。 http://space.**/Upload/Blog/2008/1/14/eaedfcb8-4aab-4deb-90e3-6c534b9efbb8.jpg 就是这种古董软驱 http://space.**/Upload/Blog/2008/1/14/8a40921b-c7a0-40d1-a843-b77920a79437.jpg 软驱上的直流无刷电机 http://space.**/Upload/Blog/2008/1/14/69be3b00-85b4-468b-9540-0ae4c6c624e0.jpg 拆开后的电机 仔细拆开直流电机,将带圆盘的铝轴从中开孔,让它刚好能插入一个插头。 http://space.**/Upload/Blog/2008/1/14/4435a2cf-8b13-410b-8029-1c5aff870c70.jpg 将旋转轴加工成这样http://space.**/Upload/Blog/2008/1/14/863ba00f-e081-47fc-8618-72a3d0670539.jpg 装配好以后 按拆开时的顺序,反序将轴安装直流电机上。 http://space.**/Upload/Blog/2008/1/14/8ac68015-c0e1-48cf-aaf4-7698fdfd1d53.jpg 电机装配完成后 用两片铜片做的电刷 http://space.**/Upload/Blog/2008/1/14/fbff5a16-dbbd-4fd9-bfbb-2eef01abd8ad.jpg http://space.**/Upload/Blog/2008/1/14/67341a31-2288-4101-bd08-1082e069a1a4.jpg 电刷装好后的侧面图 将电路板上较突出的元件改焊在反面, http://space.**/Upload/Blog/2008/1/14/770338c2-4ca1-4e7e-8dcb-6e7adfd390d3.jpg 电机的电源接法。 http://space.**/Upload/Blog/2008/1/14/f4a0b0b7-3d06-44f5-a09f-d77acb406d42.jpg从电路板标注的符号看,“+”为电源正,“G”为电源负,“C”与“M”端分别与电源正相连匀可使电机运转将一张旧唱片按电机座的位置开孔,而定位用的挡光板应根据电路板上感光组件的位置确定。http://space.**/Upload/Blog/2008/1/14/c0a58548-2d3f-4c86-bd16-b7234c049693.jpg 二。电路板的制作 本制作品用51单片机控制,具体电原理图如下:http://space.**/Upload/Blog/2008/1/14/1d1cd146-5d5c-4ef1-a7ec-3e9a723203a3.jpghttp://space.**/Upload/Blog/2008/1/14/5a2b935d-e63f-4a10-a673-9458d9c1539b.jpg 用Protel 99设计制作了电路板。http://space.**/Upload/Blog/2008/1/14/ed73acc5-761f-483d-94be-3ede965f7cd3.jpghttp://space.**/Upload/Blog/2008/1/14/d12a8e56-36b6-47f2-b7cb-dd0541515072.jpg http://space.**/Upload/Blog/2008/1/14/d57a0685-ce41-4e50-bb69-97af1555fc30.jpg 最后得到完成的作品。http://space.**/Upload/Blog/2008/1/14/93604185-7de7-4ccd-9855-e6254bad3b19.jpg 遥控器用的是松下车载机的,只用了其中的六个键。http://space.**/Upload/Blog/2008/1/14/07788746-4078-428a-8e7d-30e7fdbe658c.jpg 三。软件编程 因学的是C51(不懂汇编)这里只提供C语言源程序,并限制为无遥控功能。也可提供带遥控功能的hex文件。 #include <reg51.h>sbit gate11=P3^0; sbit gate12=P3^1;#define unit unsigned int #define uchar unsigned charuchar data BUFFER[]={0,0,0,0,1,1,7}; uchar data M[]={31,28,31,30,31,30,31,31,30,31,30,31};uchar code NUM1[] = {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- 0x40,0x84,0xC0,0xFF,0x80,0x7B,0x00,0x00,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, };uchar code NUM2[]= { 0x00,0x00,0x7f,0x80,0xff,0xc0,0x82,0x40, // -0- 0x8c,0x40,0x90,0x40,0xff,0xc0,0x7f,0x80, 0x00,0x00,0x00,0x00,0x20,0x40,0x60,0x40, // -1- 0xff,0xc0,0xff,0xc0,0x00,0x40,0x00,0x40, 0x00,0x00,0x41,0xc0,0xc3,0xc0,0x86,0x40, // -2- 0x8c,0x40,0x98,0x40,0xf0,0xc0,0x60,0xc0, 0x00,0x00,0x40,0x80,0xc0,0xc0,0x88,0x40, // -3- 0x88,0x40,0x88,0x40,0xff,0xc0,0x77,0x80, 0x00,0x00,0x0c,0x00,0x1c,0x00,0x34,0x00, // -4- 0x64,0x40,0xff,0xc0,0xff,0xc0,0x04,0x40, 0x00,0x00,0xf8,0x80,0xf8,0xc0,0x88,0x40, // -5- 0x88,0x40,0x8c,0x40,0x8f,0xc0,0x87,0x80, 0x00,0x00,0x3f,0x80,0x7f,0xc0,0xc8,0x40, // -6- 0x88,0x40,0x88,0x40,0x0f,0xc0,0x07,0x80, 0x00,0x00,0xc0,0x00,0xc0,0x00,0x83,0xc0, // -7- 0x87,0xc0,0x8c,0x00,0xf8,0x00,0xf0,0x00, 0x00,0x00,0x77,0x80,0xff,0xc0,0x88,0x40, // -8- 0x88,0x40,0x88,0x40,0xff,0xc0,0x77,0x80, 0x00,0x00,0x70,0x00,0xf8,0x40,0x88,0x40, // -9- 0x88,0x40,0x88,0xc0,0xff,0x80,0x7f,0x00, 0x00,0x00,0x00,0xc0,0x01,0x80,0x03,0x00, // -/- 0x06,0x00,0x0c,0x00,0x18,0x00,0x30,0x00, };unit disp1,disp2,key1,key2; unit ii,jj; unit i,sw,xz;void Delay(unit ms){ ms="ms"*3; while(--ms); } void num_led(int kk, int tt) { int jj; 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]; Delay(20); P1=0xff;P2=0xff; } }void display_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="disp1"*16;jj=disp2*16; num_led(ii,jj); P2=0xff;P1=0xff;Delay(60); ii="160";jj=160; num_led(ii,jj); P2=0xff;P1=0xff;Delay(60); disp1=BUFFER[2]/10;disp2=BUFFER[5]-(BUFFER[5]/10)*10; ii="disp1"*16;jj=disp2*16; num_led(ii,jj); P2=0xff;P1=0xff;Delay(60);
disp1=BUFFER[2]-disp1*10;disp2=BUFFER[5]/10; ii="disp1"*16;jj=disp2*16; num_led(ii,jj); P2=0xff;P1=0xff;Delay(60); ii="160";jj=160; num_led(ii,jj); P2=0xff;P1=0xff;Delay(60); disp1=BUFFER[1]/10;disp2=BUFFER[6]-(BUFFER[6]/10)*10; ii="disp1"*16;jj=disp2*16; num_led(ii,jj); P2=0xff;P1=0xff;Delay(60);
disp1=BUFFER[1]-disp1*10;disp2=BUFFER[6]/10; ii="disp1"*16;jj=disp2*16; num_led(ii,jj); P2=0xff;P1=0xff;Delay(60); } void timer0(void) interrupt 1 using 1 { TMOD="0x11"; TH0=-(5000/256); TL0=-(5000%256); TR0=1; BUFFER[0]=BUFFER[0]+1; if (BUFFER[6]%4==0) M[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; } } } } } } } } void intersvr0(void) interrupt 0 { sw=1; }void main(void) { xz="8"; key1=1;key2=0; EA="1"; IT0=1;EX0=1; IT1=1;ET0=1; TMOD="0x11"; TH0=-5000/256; TL0=-5000%256; TR0=1;for(;;){ Delay(10); if(sw==1) {display_clock();sw=0;} } } [url=http://hiphotos.baidu.com/52%5Fdiy/pic/item/89faa725488e556634a80fae.jpg][/url] 四。运行效果 从开机,调整到最后完成。http://space.**/Upload/Blog/2008/1/14/53b587c0-15c0-4dfb-9531-399b74924bb1.jpg 开机时http://space.**/Upload/Blog/2008/1/14/576db404-1897-496b-bf56-55bd78dbb613.jpg 调时状态 http://space.**/Upload/Blog/2008/1/14/c626fe0e-a986-427c-9b67-93076615523b.jpg 正常运行状态 |