fengyepiaolei
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit wela=P2^0;
sbit dula=P2^1;
uint temp,shi,ge;
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()
{
    temp=12;
	shi=temp/10;
	ge=temp%10;
	while(1)
	{  	
	    dula=1;
		P0=table[shi];
		dula=0;

		wela=1;
		P0=0xfe;
		wela=0;
		Delay(5);
		
		dula=1;
		P0=table[ge];
		dula=0;

		wela=1;
		P0=0xfd;
		wela=0;
		Delay(5);
	}
}
void Delay(uint z)
{
	uint x,y;
	for(x=z;x>0;x--)
	{
		for(y=110;y>0;y--);
	}
}

  

分类:

技术点:

相关文章:

  • 2021-10-19
  • 2021-11-02
  • 2021-09-27
  • 2021-11-28
  • 2021-09-27
猜你喜欢
  • 2021-09-27
  • 2021-11-18
  • 2021-09-27
  • 2021-09-27
  • 2021-11-18
  • 2021-11-11
  • 2021-11-18
  • 2022-01-01
相关资源
相似解决方案