仿真电路图如下:
程序代码如下:
#include <reg52.h>
#include <intrins.h>
#include <math.h>
#include <stdio.h>
#define uchar unsigned char
#define uint unsigned int
uchar temp;
/*------------------------------------------
按键扫描
--------------------------------------------*/
void KeyScan(void)
{
P1=0xfe;
temp=P1;
temp=temp&0xf0;
if(temp!=0xf0)
{
//delay(1);
if(temp!=0xf0)
{
temp=P1;
switch(temp)
{
case 0xee: