keyboard_test.c
来自「IARSOURCECODE是基于LPC2478嵌入式软件IAR EWARM V4」· C语言 代码 · 共 45 行
C
45 行
#include "LPC2468.h" /* LPC24xx definitions */
#include "type.h"
#include "irq.h"
#include "target.h"
#include "timer.h"
#include "fio.h"
#include "keyboard.h"
#include "uart0.h"
/*****************************************************************************
** Main Function main()
******************************************************************************/
int main (void)
{
unsigned char keyvalue=0,char_buf[]="Key has pressed!\r\n";
DWORD counter=0,i;
TargetResetInit();
enable_timer(0);
Key_Init();
LedsInit();
UART0Init(9600);
while ( 1 )
{
keyvalue = KeyScan();
if(keyvalue != 0)
{
LedOn(4-keyvalue);
delayMs(0,200);
char_buf[4] = 0x30 + keyvalue/10;
char_buf[5] = 0x30 + keyvalue%10;
UART0_puts(char_buf);
LedOff(4-keyvalue);
}
}
}
/*****************************************************************************
** End Of File
*****************************************************************************/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?