AVR單片機(jī)程序——電腦鍵盤(P/S2口協(xié)議)——pckey
#include <avr/io.h>
#include interrupt.h>
#include
#include
#include
#include "scancodes.h"
#include "74c922.h"
#define GETPSDATA()
#define GETPSCLK() ((PIND>>PIND2)&0x1) //connetc to PD2
static unsigned char IntNum = 0; //count the interrupt
static unsigned char KeyV; //it is the key Value
static unsigned char DisNum = 1; //顯示用指針
static unsigned char Key_UP=0;//Key_UP means release the key, Shift = 0
static unsigned char BF = 0; //標(biāo)識(shí)是否有字符被收到
SIGNAL(SIG_INTERRUPT0)
{
}
void Decode(unsigned char ScanCode) //注意:如SHIFT+G為12H 34H F0H 34H F0H 12H,也就是說(shuō)shift的通碼+G的通碼+shift的斷碼+G的斷碼
{
}
int main(void)
{
}
"scancodes.h"
unsigned char/* code*/ UnShifted[59][2] = {
0x1C, a,
0x32, b,
0x21, c,
0x23, d,
0x24, e,
0x2B, f,
0x34, g,
0x33, h,
0x43, i,
0x3B, j,
0x42, k,
0x4B, l,
0x3A, m,
0x31, n,
0x44, o,
0x4D, p,
0x15, q,
0x2D, r,
0x1B, s,
0x2C, t,
0x3C, u,
0x2A, v,
0x1D, w,
0x22, x,
0x35, y,
0x1A, z,
0x45, 0,
0x16, 1,
0x1E, 2,
0x26, 3,
0x25, 4,
0x2E, 5,
0x36, 6,
0x3D, 7,
0x3E, 8,
0x46, 9,
0x0E, `,
0x4E, -,
0x55, =,
0x5D, ,
0x29, ,
0x54, [,
0x5B, ],
0x4C, ;,
0x52, ,
0x41, ,,
0x49, .,
0x4A, /,
0x71, .,
0x70, 0,
0x69, 1,
0x72, 2,
0x7A, 3,
0x6B, 4,
0x73, 5,
0x74, 6,
0x6C, 7,
0x75, 8,
0x7D, 9,
};
unsigned char/* code*/ Shifted[59][2] = {
0x1C, A,
0x32, B,
0x21, C,
0x23, D,
0x24, E,
0x2B, F,
0x34, G,
0x33, H,
0x43, I,
0x3B, J,
0x42, K,
0x4B, L,
0x3A, M,
0x31, N,
0x44, O,
0x4D, P,
0x15, Q,
0x2D, R,
0x1B, S,
0x2C, T,
0x3C, U,
0x2A, V,
0x1D, W,
0x22, X,
0x35, Y,
0x1A, Z,
0x45, 0,
0x16, 1,
0x1E, 2,
0x26, 3,
0x25, 4,
0x2E, 5,
0x36, 6,
0x3D, 7,
0x3E, 8,
0x46, 9,
0x0E, ~,
0x4E, _,
0x55, +,
0x5D, |,
0x29, ,
0x54, {,
0x5B, },
0x4C, :,
0x52, ",
0x41, <,
0x49, >,
0x4A, ?,
0x71, .,
0x70, 0,
0x69, 1,
0x72, 2,
0x7A, 3,
0x6B, 4,
0x73, 5,
0x74, 6,
0x6C, 7,
0x75, 8,
0x7D, 9,
};
評(píng)論