芯片解密STC12C5A60S2单片机矩阵键盘
芯片解密单个读键
芯片解密unsigned int a[4]={0xfe,0xfd,0xfb,0xf7};
芯片解密unsigned char Readkey()//读出单个键值
{ unsigned int i,y; keyport=0xf0;//11110000
delay(10);
i=keyport;
if(i != 0xf0)//判断有无键按下
{
delay(30);
if(i != 0xf0)
{
Delay10ms();
Delay10ms();
Delay10ms();
while(i != 0xf0)
{
Delay10ms();
i=0;
while(i<=3)//判断何健按下
{
Delay10ms();
Delay10ms();
Delay10ms();
Delay10ms();
keyport=a[ i];[ i]
delay(10);
x=keyport;
if(x != a[ i])[ i]
{
y=x;
return (y);
}
i++;
x=0;
}
}
}
}
return (0xff);
}
unsigned char keyzhi(void)
{
switch(Readkey())
{
case 0xe7:n= 1 ;break;//11100111
case 0xd7:n= 2 ;break;//11010111
case 0xb7:n=3 ;break;//10110111
case 0xeb:n= 4 ;break;
case 0xdb:n= 5 ;break;
case 0xbb:n= 6 ;break;
case 0xed:n= 7 ;break;
case 0xdd:n= 8 ;break;
case 0xbd:n= 9 ;break;
case 0x77:n=10 ;break;//0
case 0x7b:n= 11;break;//确认
case 0x7d:n= 12;break;//重启
case 0xff:return 0x11;break;
}
//return n;
if(P3!=0XF0)
{
Delay10ms();
Delay10ms();
if(P3&0xf0==0XF0)
{
return n;
}
}
}这个程序可以拿来读3*4键盘的值,也可以加一行表示4*4键盘
2,查找元器件程序
#include "reg52.h"
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
#define keyport P3
#define LCD12864_DA_PORT P0
sbit LCD12864_RS_PORT=P2^5;
sbit LCD12864_RW_PORT=P2^6;
sbit LCD12864_E_PORT =P2^7;
unsigned long code BUF1[]={910,910,151,151,301,402,762,913,683,473,472,000,000,105,123,682,431,000,510,151,515,513,000,000,221,912,000,361,390,010,100,201,154,030,504,305,302,560,822,682,241,561,512,101,471,202,000,000,204,392,392,333,474,683,121,101,050,010,700,433,685,515,152,270,510,202,202,513,010,103,152,000,391,000,132,431,822,510,303,123,512,513,511,681,103,501,000,470,361,000,151,153,273,202,560,510,391,222,602,203,274,224,220,471,361,391,155,201,204,104,474,204,100,502,102,205,503,502,000,210,120,334,331,684,105,271,221,103,010,431,500,105,511,121,102,102,101,000,391};
unsigned long code BUF2[]={101,101,102,102,103,103,104,104,105,106,106,202,202,203,203,204,204,205,205,206,208,208,209,209,210,210,211,212,212,301,302,302,303,303,304,304,305,305,306,306,307,307,308,308,309,309,310,310,311,311,312,312,402,402,403,403,404,404,405,405,406,406,407,407,409,409,410,410,411,411,501,501,502,502,503,503,504,504,505,505,506,506,601,601,602,602,603,603,604,604,605,605,606,606,701,701,702,702,703,703,704,704,705,705,706,706,801,801,802,802,803,803,804,805,805,806,806,901,901,902,902,903,903,904,904,905,905,1001,1001,1002,1002,1003,1003,1004,1004,1005,1005,1006,1006};//先行后列
unsigned int BUF[4];
void LCD12864_WaitIdle();
void LCD12864_COM_Write( unsigned char com_da);
void LCD12864_NoWaitIdle_COM_Write(unsigned char com_da);
void LCD12864_Data_Write(unsigned char da);
void lcd_delay_ms(unsigned char x);
void LCD12864_Reset();
void LCD12864_write_word(unsigned char *s);
void LCD12864_HAIZI_SET();
void Delay10ms();
void display();
unsigned char check();
unsigned char Readkey();
unsigned int x,nn,dat;
unsigned int a[4]={0xfe,0xfd,0xfb,0xf7};//11111110,11111101
unsigned char keyzhi(void);
int n=0;
int m=0;
uchar ii;
uchar iii=1;
unsigned int input,kk;
uchar num;

芯片解密