ZKX's LAB

4 4矩阵键盘控制七段数码管 51单片机4*4矩阵键盘控制数码管显示,下面的程序不能实现?

2020-07-23知识29

急求4*4矩阵键盘控制数码管显示! 51单片机 共阳极数码管 如果是共阴极数码管则 display()里的P0=0xff;改为P0=0x00;P2=smg_we[a];改为P2=~smg_we[a];P0=dsp_code_ca[xianshi[a]];改为P0=~dsp_code_ca[xianshi[a]];即可includedefine uchar unsigned chardefine uint unsigned intuchar key_char,key_char0;uint aa,bb,num;uint number[8]={16,16,16,16,16,16,16,16};uint xianshi[8]={16,16,16,16,16,16,16,16};uchar code Key_init[]={0xfe,0xfd,0xfb,0xf7};uchar code smg_we[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};uchar code dsp_code_ca[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0xff};共阳极数码管0~Fvoid delay(uint);bit Test_Key();void display();void main(void){uint x,y,z;TMOD=0x01;TH0=(65536-50000)/256;TL0=(65536-50000)%256;EA=1;开启总中断ET0=1;TR0=0;while(1){if。TR0){if(Test_Key()){number[x]=num;x+;for(y=x,z=0;y>;0;y-,z+){xianshi[8-y]=number[z];}if(x=8){x=0;TR0=1;}}}display();}}void time0()interrupt 1/T1中断用来计数器溢出 数码管显示{TH0=(65536-50000)/256;TL0=(65536-50000)%256;aa+。帮我改成4*4矩阵键盘控制 4位共阴极数码管显示! 51单片机 #includedefine uchar unsigned charuchar tab[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};0到fuchar keyval;uint x;void delay(uchar a){uchar i,j;for(i=0;i;i+)for(j=0;j;j+);}uchar kbscan(void){unsigned char sccode,recode;P3=0x0f;发0扫描,列线输入if((P3&0x0f)。0x0f)/有键按下{delay(20);延时去抖动if((P3&0x0f)。0x0f){sccode=0xef;逐行扫描初值while((sccode&0x01)。0){P3=sccode;if((P3&0x0f)。0x0f){recode=(P3&0x0f)|0xf0;while((P3&0x0f)。0x0f);等待键抬起return((~sccode)+(~recode));}elsesccode=(sccode)|0x01;}}}return 0;无键按下,返回0}void getkey(void){unsigned char key;key=kbscan();if(key=0){return;}switch(key){case 0x11:keyval=7;break;case 0x12:keyval=4;break;case 0x14:keyval=1;break;case 0x18:keyval=10;break;case 0x21:keyval=8;break;case 0x22:keyval=5;break;case 0x24:keyval=2;break;case 0x28:keyval=0;break;case 0x41:keyval=9;break;case 0x42:keyval=6;break;case 0x44:keyval=3;break;case 0x48:keyval=11;break;case 0x81:keyval。用汇编语言编写,8086cpu,用8255a,4个7段数码管显示4×4矩阵键盘上的值 楼主先确定下来电路,然后才能编程。采纳答案,是错误的。他的程序中,既没有 4*4 的键盘,也没有 4 位数码管。竟然还说:《正好我们做了这个实验。为了几个积分,就明目张胆的骗人!真是臭不要脸!急求!!!AT89C51的4x4矩阵键盘扫描和4个7段码数码管显示程序。C语言程序,附上具体的语句说明。 我的空间,有现成的。51单片机4*4矩阵键盘控制数码管显示,下面的程序不能实现? uchar aa,bb,cc,dd,num,i,key,shu;num=num*10+i;if(num>;1000)num=0;num,0~255,能大于 1000?键盘程序,太滥了,去掉一大半,就够用了。求FPGA连接4*4矩阵键盘4位七段数码管(共阴)vhdl程序 跪谢! library ieee;use ieee.std_logic_1164.all;entity keyarray is portsysclk:in std_logic;key1:in std_logic_vector(3 downto 0);key2:out std_logic_vector(3 downto 0);duan:out std_logic_vector(7 downto 0);wei:out std_logicend keyarray;architecture rtl of keyarray issignal led:std_logic_vector(7 downto 0);beginprocess(sysclk)VARIABLE sig_com : std_logic_vector(3 downto 0):=\"1110;beginif(sysclk 'event and sysclk='1')thencase sig_com isWHEN\"1110\"=>;key2<;=sig_com;if(key1/\"1111\")thenled<;=sig_com & key1;sig_com:=\"1110\";elsesig_com:=\"1101\";end if;WHEN\"1101\"=>;key2<;=sig_com;if(key1/\"1111\")thenled<;=sig_com& key1;sig_com:=\"1101\";elsesig_com:=\"1011\";end if;WHEN\"1011\"=>;key2<;=sig_com;if(key1/\"1111\")thenled<;=sig_com& key1;sig_com:=\"1011\";elsesig_com:=\"0111\";end if;WHEN\"0111\"=>;key2<;=sig_com;if(key1/\"1111\")thenled<;=sig_com & key1;sig_com:=\"0111\";elsesig_com:=\"1110\";end if;when others=>;sig_com:=\"1110\";end case;end if;end process;process(sysclk)beginwei;case led iswhen\"01110111\"=>;duan;7when。

#num#unsigned#vector#51单片机#temp

随机阅读

qrcode
访问手机版