数码管显示模块

我自己完善的数码管显示模块,希望能给你一些参考

/***************************************************************

只要输入需要显示的数据即可;

最长是八位数据,

也可以指定第一个数据的显示位置,默认为第一位。

**************************************************************/

#include "delay.h"

#include "SMG.h"

#include <reg52.h>

//端口定义

/********************************************/

sbit wela=P2^3;

sbit duan=P2^2;

/*******************************************/

//段选的数据编码

/****************************************************************/

unsigned char code table[]={0x3f,0x06,0x5b,0x4f,

0x66,0x6d,0x7d,0x07,

0x7f,0x6f};

/*****************************************************************/

//位选的数据编码

unsigned char code table1[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};

/******************************************************************/

static unsigned int display_data[8];

//显示函数

/********************************************************/

void display(unsigned long x,int y)//y可用作指示第一个显示起始位,默认起始位为第一位 {

unsigned int i=0,j=0;

static int num;

while(x)

{

*(display_data+i)=x%10;

x=x/10;

i++;

num=i;

你可能喜欢

  • max7219
  • LED数码管动态显示
  • 电子元器件图片
  • 单片机C语言程序
  • ADC0809中文资料
  • 单片机编程
  • STC89C52单片机介绍
  • 电子元器件知识

数码管显示模块相关文档

最新文档

返回顶部