数码管9到0循环显示

来源:互联网 发布:统计分析软件 编辑:程序博客网 时间:2024/06/05 05:39

源程序:

#include<reg51.h>
void delay(int x);
#define SEG P2
void main()
{
  int k;
  charTAB[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};//共阴极
  while(1)
  {
   for(k=9;k>=0;k--)
 {
   SEG=TAB[k];
   delay(500);
 }
  }
 
void delay(int x)
{
  int i,j;
  for(i=0;i<x;i++)
   for(j=0;j<600;j++);
 

0 0
原创粉丝点击