|
| //说明:由key.c文件和key.h文件组成,编译环境KEIL 750A,使用外部端口0X7F1D的输入输出作为行列线。 |
#define KEY #i nclude "includes.h"
void KeyBufIn(unsigned char kcode) { EA=0; if(KeyNRead < KEY_BUF_SIZE) { KeyNRead++; KeyBuf[KeyBufInIx++] = kcode; if (KeyBufInIx >= KEY_BUF_SIZE) { KeyBufInIx = 0; } EA=1; } else { EA=1; } } unsigned char KeyDecode(void) { unsigned char col; unsigned char row; unsigned char offset; unsigned char done; unsigned char col_id; unsigned char msk; done=FALSE; row=0; while (row < KEY_MAX_ROWS && !done) { KeySelRow(row); if(KeyIsKeyDown()) { done = TRUE; } else { row++; } } col=KeyGetCol(); offset = 0; /* if (col & KEY_SHIFT1_MSK) { |