单片机数码管想让前6个一起亮,但是烧录后只有第一个亮,求助是什么原因?
#include<reg52.h>#defineuintunsignedint#defineucharunsignedcharsbitwela=P3^4;sbitdula...
#include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit wela = P3^4;
sbit dula = P3^5;
uchar num;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
void delay(uint z);
void main()
{
wela = 1;
P0 = 0xff;
wela = 0;
while (1)
{
for (num = 0;num < 16; num++)
{
dula = 1;
P0 = table [num];
dula = 0;
delay (1000);
}
}
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
} 展开
#define uint unsigned int
#define uchar unsigned char
sbit wela = P3^4;
sbit dula = P3^5;
uchar num;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
void delay(uint z);
void main()
{
wela = 1;
P0 = 0xff;
wela = 0;
while (1)
{
for (num = 0;num < 16; num++)
{
dula = 1;
P0 = table [num];
dula = 0;
delay (1000);
}
}
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
} 展开
3个回答
杭州丹川科技
2024-12-24 广告
2024-12-24 广告
随着工业设备的自动化程度越来越高,各个行业的工控板的数量也越来越多,下面就介绍在维修中常用的几种方法。1、观察法:当我们拿到一块待维修的电路板时, 首先对它的外观进行仔细的观察。如果电路板被烧过, 那么在给电路板通电前, 一定要仔细检查电源...
点击进入详情页
本回答由杭州丹川科技提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询