|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
求助,大家帮我看看,怎么就显示一个0呢。附上代码。先谢谢啦
#include<c:\Keil\C51\INC\STC\STC12c5a60S2.H>
#define uchar unsigned char
#define uint unsigned int
#define dateport P0
sbit LATCH1=P2^2;
sbit LATCH2=P2^3;
uchar i=0,qian,bai,shi,ge;
unsigned char code duanma[8]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07};
unsigned char code weima[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void delay(unsigned int t)
{
while(--t);
}
unsigned char q=3450;
void display()
{
qian=q/1000;
bai=q%1000/100;
shi=q%100/10;
ge=q%10;
}
void main()
{
P0=0x00;
while(1)
{
dateport=weima[qian];
LATCH2=1;
LATCH2=0;
dateport=duanma[qian];
LATCH1=1;
LATCH1=0;
delay(200);
dateport=weima[bai];
LATCH2=1;
LATCH2=0;
dateport=duanma[bai];
LATCH1=1;
LATCH1=0;
delay(200);
dateport=weima[shi];
LATCH2=1;
LATCH2=0;
dateport=duanma[shi];
LATCH1=1;
LATCH1=0;
delay(200);
dateport=weima[ge];
LATCH2=1;
LATCH2=0;
dateport=duanma[ge];
LATCH1=1;
LATCH1=0;
delay(200);
/* dateport=weima;
LATCH2=1;
LATCH2=0;
dateport=duanma;
LATCH1=1;
LATCH1=0;
delay(200);
*/
i++;
if(8==i) i=0;
}
} |
|