wnlt.net
当前位置:首页 >> 单片机程序求修改,实现按键控制数码管0%9,急!!! >>

单片机程序求修改,实现按键控制数码管0%9,急!!!

#include unsigned int num,a; sbit key0=P1^0; sbit key1=P1^1; sbit key2=P1^2; sbit key3=P1^3; bit flag; unsigned char code led_code[20] = { 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xd8, 0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e}; void ...

仿真图就不上了,按键加在P3.0 #include #include #define uint unsigned int #define uchar unsigned char sbit KEY=P3^0; uchar aa,num,flag; uchar code table[]={ 0x3f,0x06,0x5b,0x4f, 0x66,0x6d,0x7d,0x07, 0x7f,0x6f,0x77,0x7c, 0x39,0x5...

参考: http://hi.baidu.com/do_sermon/item/36a512cf517a3a08ac092f47

#include < reg52.h > // 嵌入51单片机头文件 #define uchar unsigned char// 宏定义,用uchar替代无符号字符型 #define uint unsigned int// 宏定义,用uint 替代无符号整数型 sbit Key = P2 ^ 7; uchar Count = 0; uchar code DataChar[10] =...

ORG 0000H LJMP MAIN ORG 000BH LJMP T0ISR ORG 0030H MAIN: MOV TMOD,#01H MOV TH0,#HING(65536-65000) MOV TL0,#LOW(65536-65000) SETB ET0 SETB EA LOOP: JB P3.7,$ JNB P3.7,$ INC R2 CJNE R2,#3,LOOP1 MOV R2,#0 LOOP1: MOV A,R2 JNZ LOOP2...

#include sbit k1=P1^0; #define uint16 unsigned int #define uchar unsigned char uchar code shuzu[ ]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; void delay(){ uint16 i=1000; while(i--);} void main() { uchar n ; P2=0...

#include #define uchar unsigned char #define uint unsigned int uchar code table[]= { 0xc0,0xf9,0xa4,0xb0, 0x99,0x92,0x82,0xf8, 0x80,0x90,0x88,0x83, 0xc6,0xa1,0x86,0x8e } ;//共阳极数码管0 为亮 sbit wei=P1^0; void delay(uchar t)/...

你这没有给出原理图,数码管和按键是怎么接的?是仿真实现吗,下图是仿真图,用了四位一体的共阴数码管,4个按键在P3.4~P3.7上。 仿真结果,你要是仿真,就按这个仿真图画,程序就完全适用。如果是实物开发板,就是根据开发板,适当修改程序了。...

#include#define uchar unsigned chruchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};uchar key;void ext0() interrupt 0{key++;key%=10;}void ext1() interrupt 2{dat--;if(dat>9)dat=9;}main(){EX0=1;EX1=1;IT0=1;IT...

1.这是1~9再0~9吧。如果是0开始, INCR0 MOVA,R0;这2条先后顺序对换一下 2.CJNEA,#10,LOOP MOV R0,#0 ;加这2条 MOV A,R0;加 3.还有就是你的延时时间太短了,每个数字显示得太快,才65ms。

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