Professional Documents
Culture Documents
KeyPad PROGRAM
KeyPad PROGRAM
int main(void) { unsigned int scanCode, rowCode, colCode, index; unsigned int arrayHex[]={0x7E, 0x7D, 0x7B, 0x77, 0xBE, 0xBD, 0xBB, 0xB7, 0xDE, 0xDD, 0xDB, 0xD7, 0xEE, 0xED, 0xEB, 0xE7}; unsigned int arrayCheckAscii[]={0x31, 0x32, 0x33, 0x65, 0x34, 0x35, 0x36, 0x66, 0x37, 0x38, 0x39, 0x67, 0x2A, 0x30, 0x23, 0x68};
uart_init();
IODIR0=0x3FC; IOCLR0=0x3FC;
while(1) { IODIR0=0x3C; // direction of rows are output and column as input IOCLR0=0x3C; // rows are grounded
uart_tx(arrayCheckAscii[index]); delay(300000); }