#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit P2_6=P2^6; //数码管位选74HC573锁存端
sbit P2_7=P2^7; //数码段位选74HC573锁存端
oid delay(uchar xms); //声明函数delay()原型,延时函数
void display(char *ptr);
uchar code seg[]=
{0x3f,0x06,0x5b,0x4f,0x66, //段码表:0,1,2,3,4
0x6d,0x7d,0x07,0x7f,0x6f, //段码表:5,6,7,8,9 0x77,0x7c,0x39,0x5e,0x79, //段码表:A,b,C,d,E 0x71,0x00}; //段码表:F,“熄灭” void main(void)
{
long int number;
char buff[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //显示缓冲数字
buff char *ptr=buff;
number=5211314;
buff[1]=number/1000000; //5211314除以1000000取整 =5
buff[2]=number%1000000/100000; //5211314除以1000000取余211314,除以100000取整=2
buff[3]=number%100000/10000; //5211314除以100000取余11314,除以10000取整=1
buff[4]=number%10000/1000; //5211314除以10000取余1314,除以1000取
基于51单片机的数码管动态显示
最新推荐文章于 2024-06-19 21:11:07 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)