关于仿真键盘的问题
我用STM32在调试键盘的时候,发现单步执行程序,键盘能检测到,而全速运行,则无法检测到键盘被按下,请问这是什么原因呢?逻辑应该不会有问题,因为单步执行程序是能够检测到键盘的.请大家帮帮忙,谢谢.注:调试的是4*4键盘矩阵,四个I/O配置成推挽输出,四个I/O配置成下拉输入.回复:关于仿真键盘的问题
额~没人知道是为什么吗?:'(程序是这样的:
端口配置:
//Key pin
//x out
GPIO_InitStructure.GPIO_Pin = PIN_KEYX1 | PIN_KEYX2 | PIN_KEYX3 | PIN_KEYX4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(KEY_PORT, &GPIO_InitStructure);
//y in
//GPIO_InitStructure.GPIO_Pin = PIN_KEYY1 | PIN_KEYY2 | PIN_KEYY3 | PIN_KEYY4;//s//此句有问题
GPIO_InitStructure.GPIO_Pin = PIN_KEYY2 | PIN_KEYY3 | PIN_KEYY4;//s//
//s//GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
//s//GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(KEY_PORT, &GPIO_InitStructure);
//y in
GPIO_InitStructure.GPIO_Pin = PIN_KEYY1;
//s//GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
//s//GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(KEY_PORTB, &GPIO_InitStructure);
利用中断检测键盘
<span style="color: #800000">void SysTickHandler(void)
{
if(SysTick_key_scan_count
页:
[1]