新手上路
- 积分
- 35
- 金钱
- 35
- 注册时间
- 2015-4-16
- 在线时间
- 0 小时
|

楼主 |
发表于 2015-5-8 14:57:02
|
显示全部楼层
回复【10楼】精神不死6530:
---------------------------------
但是这段程序跑不下去啊
void KeyBoard_Init(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7;
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Init(GPIOC,&GPIO_InitStructure);
GPIO_Write(GPIOC,0x00ff);
}
int main(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD,ENABLE);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7;
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Init(GPIOD,&GPIO_InitStructure);
KeyBoard_Init();
GPIO_Write(GPIOC,0x00ff);
while(1)
{
if(GPIO_ReadInputData(GPIOC)==0x00ff)
{
GPIO_SetBits(GPIOD,GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_7);
GPIO_ResetBits(GPIOD,GPIO_Pin_2);
delay_us(1000000);
GPIO_SetBits(GPIOD,GPIO_Pin_2);
delay_us(1000000);
}
}
} |
|