wnlt.net
当前位置:首页 >> 利用89C51串行口设计4位静态数码管显示器,编写汇... >>

利用89C51串行口设计4位静态数码管显示器,编写汇...

#include char tt = 0;bit flg;char code table[] = { //共阳段码 0 ~ 9 0xC0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90};void main(){ TMOD = 0x01; TH0 = 0x3C; TL0 = 0xB0; IE = 0x82; TR0 = 1; while (1);}void b() interrupt 1{ TH0 = 0x3C; TL0 = 0

/********************//*按键静态显示不同数字,即按1键显示1动态显示:数字移动显示*/#include#define uint unsigned int #define uchar unsigned char sbit Dp=P0^6;sbit d1=P2^4;sbit d2=P2^5;sbit d3=P2^6;sbit d4=P2^7;uchar code table[]={0x28,0

最简单的就是用四个IO口分别驱动四个数码管每个IO口分别送出相应的段码显示值主程序中一次扫面四个IO口即可

# include <reg51.h> // 显示 0 1 2 3 4 5 6 7 , 8位数码管 试试 char code table[] = {0x3f, 0x06, 0x5b, 0x4f,0x66, 0x6d, 0x7d, 0x07,0x7f, 0x6f, 0x77, 0x7c,0x39, 0x53, 0x79, 0x71}; void delayms(int k); void main() { while (1) { char i = 0; for (P3 = 0xfe; P3 !

#include "reg51.h"#define uchar unsigned char#define uint unsigned intuchar d[4];uint xs;uchar code duanma[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};uchar code weima[]={0xfe,0xfd,0xfb,0xf7};void delay(uchar tt){ uchar j; for(tt;tt>0;

数码管是共阴极的,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); } 差不多就是这样啦

P1口片选 P3口位选 P3.0对应最右边那个 P3.3对应最左边那个 数码管共阳四位 不显示小数点#include <reg52.h> typedef unsigned char uint8; typedef unsigned int uint16; uint8 number[]={0xFC,0x60,0xDA,0xF2,0x66, 0xB6,0xBE,0xE0,0xFE,0xF6};

wei4=0;上面少了个中括号

程序如下(用的是STC89C52芯片):#include<reg52.h>//52系列单片机头文件#define uchar unsigned char#define uint unsigned intuint x,y;uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}

很简单嘛 很久以前就 写过类似的程序 不过 我只用汇编

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