/****************************************Copyright (c)****************************************************
**--------------File Info---------------------------------------------------------------------------------
** File name:
** Last modified Date:
** Last Version:
** Descriptions:
**
**--------------------------------------------------------------------------------------------------------
** Created by: Winter_wzy
** Created date: 2018/12/5
** Version: 1.0
** Descriptions:
**--------------------------------------------------------------------------------------------------------*/
#include <reg52.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
sbit dula = P2^6;
sbit wela = P2^7;
uchar code block[] ={0x3f, 0x6, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x7, 0x7f,
0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71, 0x0};
uchar code list1[] = {0xdf, 0xcf, 0xc7, 0xc3, 0xc1, 0xc0};
uchar code list2[] = {0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe, 0x7f,0xff};
void delay(uint a);
void ono(uchar b, uint c);
void main()
{
uint k = 50;
uchar x = 0, z = 16, y = list1[z];
uchar temp = 0xdf;
uchar temp1 = block[x];
while(1)
{
ono(temp1, temp);
x++;
temp1 = block[x];
if(x > z - 1)
{
x = 0;
temp1 = block[x];
delay(100);
break;
}
temp = _cror_(temp, 1);
delay(100);
if(temp == list2[6] || temp == list2[z]) temp = 0xdf;
}
}
void delay(uint a)
{
uint i, j;
for(i = a; i > 0; i--)
for(j = 575; j > 0; j--);
}
void ono(uchar b, uint c)
{
uchar d = b;
uchar e = c;
dula = 1;
P0 = d;
dula = 0;
wela = 1;
P0 = e;
wela = 0;
}
89C51单片机数码管伪滚动显示代码
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。