是的,自己设计制作肯定最好了
但是考虑到一些初学者,不可能一下子就自己设计制作,需要一个过程的
不管怎么样,还是感谢EEPW的这次活动
焊接完毕,通电,发现只有LED1和LED2亮,开始还以为是我焊接有误,后发现本来就是这样,板子 本身存在bug。
再就是淘宝淘的IC座很水,STC12C5A16AD芯片在上面无法固定,接触不良,只有重新去买个替换掉了,大家要注意元器件的质量哦
发现LED有一个有问题,不知道是买的时候就有问题,还是我焊接时高温烧坏了,要更新掉
今天大概就这个样子了,继续奋斗!!!
差不多焊完了,但是问题一大堆,估计板子是废了,IC底座质量不过关,芯片安置不稳,接触不好,LED5不亮,奇怪了,LED2——LED9都亮除了LED5,检查,发现LED5是好的,有没有类似状况的?上几张图吧
打算用面包板来代替IC底座,继续下去···
悲催啊
发个流水灯灯程序:
#include<reg52.h>
unsigned char code led[]={0xfe,0xfd,0xfb,0xf7,
0xef,0xdf,0xbf,0x7f};
void delay1s() //延时1s
{
unsigned char i,j,k;
for(i=100;i>0;i--)
for(j=20;j>0;j--)
for(k=248;k>0;k--);
}
void main()
{
unsigned char i;
P1=0;
delay1s();
P1=0;
while(1){
for(i=0;i<8;i++) //依次亮
{
P1=led[i] ;
delay1s();
}
for(i=0;i<4;i++) //偶数号灯亮
{
P1=led[2*i];
delay1s();
}
for(i=0;i<4;i++) //奇数号灯亮
{
P1=led[2*i+1];
delay1s();
}
}
}
马上要考试,一直都在准备复习考试,所以有段时间没弄了,致歉!!!今天抽空夫学习了下,做了LCD 1602的实验:
源码:
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit rs=P2^4;
sbit rw=P2^5;
sbit lcden=P2^6;
uchar table1[]="EEPW MCU-DIY";
uchar table2[]="WWW.EEPW.COM.CN";
void delay(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=10;b>0;b--);
}
void delay1(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=100;b>0;b--);
}
void write_com(uchar com)
{
P0=com;
rs=0;
rw=0;
lcden=0;
delay(10);
lcden=1;
delay(10);
lcden=0;
}
void write_date(uchar date)
{
P0=date;
rs=1;
rw=0;
lcden=0;
delay(10);
lcden=1;
delay(10);
lcden=0;
}
void init()
{
lcden=0;
write_com(0x38);
delay(20);
write_com(0x0c);
delay(20);
write_com(0x06);
delay(20);
write_com(0x01);
delay(20);
}
void main()
{
uchar a=0;
init();
write_com(0x80+17);
delay(20);
//for(a=0;a<12;a++)
while(table1[a]!='\0')
{
write_date(table1[a]);
a++;
//delay(10000);
}
write_com(0xc0+17);
delay(10000);
for(a=0;a<15;a++)
{
write_date(table2[a]);
delay(10000);
}
for(a=0;a<16;a++)
{
write_com(0x18);
delay1(10000);
}
while(1);
}
蜂鸣器唱歌的,曲子编码来自网络
直接放代码了:
#include<reg51.h>
unsigned char Count;
sbit Speak=P2^1;
unsigned char code Song[]={
0x26,0x20,0x20,0x20,0x20,0x20,0x26,0x10,0x20,0x10,0x20,0x80,0x26,0x20,0x30 ,0x20,0x30,0x20,
0x39,0x10,0x30,0x10,0x30,0x80,0x26,0x20,0x20,0x20,0x20,0x20,0x1c,0x20,0x20,0x80,0x2b,0x20,
0x26,0x20,0x20,0x20,0x2b,0x10,0x26,0x10,0x2b,0x80,0x26,0x20,0x30,0x20,0x30,0x20,0x39,0x10,
0x26,0x10,0x26,0x60,0x40,0x10,0x39,0x10,0x26,0x20,0x30,0x20,0x30,0x20,0x39,0x10,0x26,0x10,
0x26,0x80,0x26,0x20,0x2b,0x10,0x2b,0x10,0x2b,0x20,0x30,0x10,0x39,0x10,0x26,0x10,0x2b,0x10,
0x2b,0x20,0x2b,0x40,0x40,0x20,0x20,0x10,0x20,0x10,0x2b,0x10,0x26,0x30,0x30,0x80,0x18,0x20,
0x18,0x20,0x26,0x20,0x20,0x20,0x20,0x40,0x26,0x20,0x2b,0x20,0x30,0x20,0x30,0x20,0x1c,0x20,
0x20,0x20,0x20,0x80,0x1c,0x20,0x1c,0x20,0x1c,0x20,0x30,0x20,0x30,0x60,0x39,0x10,0x30,0x10,
0x20,0x20,0x2b,0x10,0x26,0x10,0x2b,0x10,0x26,0x10,0x26,0x10,0x2b,0x10,0x2b,0x80,0x18,0x20,
0x18,0x20,0x26,0x20,0x20,0x20,0x20,0x60,0x26,0x10,0x2b,0x20,0x30,0x20,0x30,0x20,0x1c,0x20,
0x20,0x20,0x20,0x80,0x26,0x20,0x30,0x10,0x30,0x10,0x30,0x20,0x39,0x20,0x26,0x10,0x2b,0x10,
0x2b,0x20,0x2b,0x40,0x40,0x10,0x40,0x10,0x20,0x10, 0x20,0x10,0x2b,0x10,0x26,0x30,0x30,0x80,0x00,
//路边的野华不要采 , 以下为这首歌的编码
0x30,0x1C,0x10,0x20,0x40,0x1C,0x10,0x18,0x10,0x20,0x10,0x1C,0x10,0x18,0x40,0x1C,0x20,0x20,
0x20,0x1C,0x20,0x18,0x20,0x20,0x80,0xFF,0x20,0x30,0x1C,0x10,0x18,0x20,0x15,0x20,0x1C,0x20,
0x20,0x20,0x26,0x40,0x20,0x20,0x2B,0x20,0x26,0x20,0x20,0x20,0x30,0x80,0xFF,0x20,0x20,0x1C,
0x10,0x18,0x10,0x20,0x20,0x26,0x20,0x2B,0x20,0x30,0x20,0x2B,0x40,0x20,0x20,0x1C,0x10,0x18,
0x10,0x20,0x20,0x26,0x20,0x2B,0x20,0x30,0x20,0x2B,0x40,0x20,0x30,0x1C,0x10,0x18,0x20,0x15,
0x20,0x1C,0x20,0x20,0x20,0x26,0x40,0x20,0x20,0x2B,0x20,0x26,0x20,0x20,0x20,0x30,0x80,0x20,
0x30,0x1C,0x10,0x20,0x10,0x1C,0x10,0x20,0x20,0x26,0x20,0x2B,0x20,0x30,0x20,0x2B,0x40,0x20,
0x15,0x1F,0x05,0x20,0x10,0x1C,0x10,0x20,0x20,0x26,0x20,0x2B,0x20,0x30,0x20,0x2B,0x40,0x20,
0x30,0x1C,0x10,0x18,0x20,0x15,0x20,0x1C,0x20,0x20,0x20,0x26,0x40,0x20,0x20,0x2B,0x20,0x26,
0x20,0x20,0x20,0x30,0x30,0x20,0x30,0x1C,0x10,0x18,0x40,0x1C,0x20,0x20,0x20,0x26,0x40,0x13,
0x60,0x18,0x20,0x15,0x40,0x13,0x40,0x18,0x80,0x00
};
void Time0_Init()
{
TMOD=0x01;
IE =0x82;
TH0 =0xD8;
TL0 =0xEF;
}
void Time0_Int() interrupt 1
{
TH0=0xD8;
TL0=0xEF;
Count++;
}
void Delay_xMs(unsigned int x)
{
unsigned int i,j;
for(i=0;i<x;i++)
for(j=0;j<3;j++);
}
void Play_Song(unsigned char i)
{
unsigned char Temp1,Temp2;
unsigned int Addr;
Count=0;
Addr=i*217;
while(1)
{
Temp1=Song[Addr++];
if(Temp1==0xFF)
{
TR0=0;
Delay_xMs(100);
}
else if(Temp1==0x00)
return;
else
{
Temp2=Song[Addr++];
TR0=1;
while(1)
{
Speak=~Speak;
Delay_xMs(Temp1);
if(Temp2==Count)
{
Count=0;
break;
}
}
}
}
}
void main()
{
Time0_Init();
while(1)
{
Play_Song(1);
}
}
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
与电子爱好者谈读图四被打赏50分 | |
与电子爱好者谈读图二被打赏50分 | |
【FRDM-MCXN947评测】Core1适配运行FreeRtos被打赏50分 | |
【FRDM-MCXN947评测】双核调试被打赏50分 | |
【CPKCORRA8D1B评测】---移植CoreMark被打赏50分 | |
【CPKCORRA8D1B评测】---打开硬件定时器被打赏50分 | |
【FRDM-MCXA156评测】4、CAN loopback模式测试被打赏50分 | |
【CPKcorRA8D1评测】--搭建初始环境被打赏50分 | |
【FRDM-MCXA156评测】3、使用FlexIO模拟UART被打赏50分 | |
【FRDM-MCXA156评测】2、rt-thread MCXA156 BSP制作被打赏50分 |