ppts.net
当前位置:首页>>关于利用单片机AT89C51与数码管,实现数字的循环显示的资料>>

利用单片机AT89C51与数码管,实现数字的循环显示

#include<reg51.h>#define uchar unsigned charuchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};//共阳级数码管码表0-9void delay(uchar a){uchar i;while(a--)for(i=0;i<120;i++);}main(){uchar dat=9;while(1) { P0=table[dat]; delay(250); dat--; if(dat>9)dat=9; }}

sbuf=dispcode[num0];//第1位 while(!ti); ti=0; led0=0; delay(2); led0=1; sbuf=dispcode[num1];//第2位 while(!ti); ti=0; led1=0; delay(2); led1=1; sbuf=dispcode[num2];//第3位 while(!ti); ti=0; led2=0; delay(2); led2=1;

<p>#include <reg52.h></p> <p>#include <intrins.h></p> <p>#define uchar unsigned char</p> <p>#define uint unsigned int</p> <p>uchar code DSY_CODE[]=</p> <p>{</p> <p> 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6

#include#define uchar unsigned charuchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};//共阳级数码管码表0-9void delay(uchar a){uchar i;while(a--)for(i=0;i9)dat=9; }}

可以啊,就显示1234吗??

#include<reg52.h>#define uint unsigned int#define uchar unsigned charuchar temp,aa,miao,fen,shi;sbit m=P3^0;sbit n=P3^1;uchar code table[]={ //数码管编码表0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};void display(uchar miao,uchar fen

ORG 0000H JMP BEGIN ORG 0030HTABLE: ; 共阴极数码管显示代码表 DB 3FH,06H,5BH,4FH,66H ;01234 DB 6DH,7DH,07H,7FH,6fh ;56789DELAY: MOV R5,#20LOOP4: MOV R6,#50H ;延时20X20msLOOP5: MOV R7,#100 DJNZ R7,$

#include#include typedef unsigned char uchar; typedef unsigned int uint; uchar code table[] = {0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8};//- 0xbf void delay(uchar t) { uchar i; while(t--) { for(i = 0;i } } void opertion () { uchar i,j,k,m,n,a,b,c,d; //显示---1 for(a =

<p>这个我仿真过了 是有用的,,,是从00开始显示 到了99会从新开始从00开始加</p> <p>#include<reg51.h></p> <p>#define uchar unsigned char </p> <p>#define uint unsigned int</p> <p>uchar code disp[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x

数码管是共阴极的,HELLO[]={0x6e,0x9e,0x1c,0x1c,0xfc}P0是段选;P2是位选char i;void delay(){for(i=10000;i>0;i--);}void main(){for(i=0;i<8;i++){P2=~(0x01<<i);P0=HELLO[i];delay();}while(1);}差不多就是这样啦

网站首页 | 网站地图
All rights reserved Powered by www.ppts.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com