设计一个由4个按键和1个LED数码管组成的单片机系统,要求按下按键,在数码管上显示对应的键号(0~3)。

如题所述

设四个按键与P0低四位相连。LED数码管与P2口相连
#include <stdio.h>
#include<absacc.h>
#define uint unsigned int
#define uchar unsigned char
#define key0 P0^0
#define key1 P0^1
#define key2 P0^2
#define key3 P0^3

uchar table[]={0x00,0x01,0x02,0x03} \\数码管字模码,不对,自己找

void main()
{
swicth()

case 0x01

case 0x02...

}
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答