单片机 16个按键每个键分别1~16的数字,在数码管显示,为什么显示乱码...答:16个按键每个键分别0~15的数字,在数码管显示,include<reg51.h> include<intrins.h> typedef unsigned char uchar;typedef unsigned int uint;sbit dula=P2^6;sbit wela=P2^7;uchar code table[] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x...
51单片机超声波测距1602显示答:以前做了一个数码管显示的超声波测距,你可以参考一下:include<reg51.h> include<intrins.h> define uchar unsigned char define uint unsigned int uchar code ledtab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};//0-9 uchar scanled,cnt1,cnt2,flasht=100;uchar dis...
51单片机开发板,用p2口控制共阳数码管,求使用开关(低电瓶)使数码管计数...答:DATEQU 30H SCANLEDEQU 34H KEY BIT P3.2 ORG 0000H LJMP MAIN ORG 001BH LJMP T1ISR;扫描显示 ORG 0030H MAIN:MOV SP,#5FH MOV TMOD,#10H MOV TH1,#0ECH MOV TL1,#078H MOV SCANLED,#0 MOV 30H,#00H MOV 31H,#10H MOV 32H,#10H MOV 33H,#10H SETB ET1 SETB TR1 SETB ...
利用51单片机,6个数码管设计一秒表。要求:刚开始时间为12点(120000...答:include<reg52.h> include<intrins.h> define uchar unsigned char define uint unsigned int define show P2 code table[16]= { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71 };code tuble[9]= { 0x00,0x7f,0xbf,0xdf,0xef,0xf7,0x...
单片机P1口接一共阳极数码管,公共端已接高电频,请编写程序使数码管循...答:include<reg51.h>unsigned char code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};//共阳极void delay(int a){unsigned char i;while(a--)for(i=0;i<120;i++);}main(){unsigned char i;while(1) { P1=table[i]...