1、矩阵按键扫描原理:
先是把列置0(推挽输出),行是输入上拉,扫描行得到行的键值;再是把行置0(推完输出),列是输入上拉,扫描列得到列的键值;最后把行列的键值相加得到最后的总的键值。
2、#include "passWD.c"
#include "passWD.h"
#include "usart.h"
#include "delay.h"
void PassWordClockInit1(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;//普通输入模式
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100M
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
GPIO_Init(GPIOE, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2;
GPIO_InitStructur