这个用来显示数码管,,,,不亮啊,,我想让它显示数字,,秒加
时间:10-02
整理:3721RD
点击:
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
//uchar duan,wei;
sbit duan=P1^6;
sbit wei=P1^7;
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
uchar code table1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void delay(uint z)
{
uint x,y;
for(x<z;x>0;x--)
for(y<100;y>0;y--);
}
void main()
{
uint i,j;
while(1)
{
wei=1;
for(j=0;j<8;j++)
{
P2=table1[j];
wei=0;
}
duan=1;
for(i=0;i<16;i++)
{
P2=table[i];
delay(20);
duan=0;
}
}
}
#define uchar unsigned char
#define uint unsigned int
//uchar duan,wei;
sbit duan=P1^6;
sbit wei=P1^7;
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
uchar code table1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void delay(uint z)
{
uint x,y;
for(x<z;x>0;x--)
for(y<100;y>0;y--);
}
void main()
{
uint i,j;
while(1)
{
wei=1;
for(j=0;j<8;j++)
{
P2=table1[j];
wei=0;
}
duan=1;
for(i=0;i<16;i++)
{
P2=table[i];
delay(20);
duan=0;
}
}
}
小编 段选和位选都没赋值怎么亮啊,另外你这是完整的程序嘛?
原因有几个,一,数码管没消隐,导致肉眼观察不到,二,电路有问题。解决方法:先试试点亮八个8试试?
怎么付?
怎么消隐?
你这主函数程序不完整啊,请上传完整的程序