int main(void)
{
delay_init(168);
LED_Init();
Wt588h_Init();
while(1)
{
PBout(3)=1;
PDout(7)=1;
delay_s(3);
PBout(3)=0;
PDout(7)=0;
delay_s(3);
}
}
大佬们有没有遇到在while里面不加最后的这个延时就不会运行。
引脚配置:
void LED_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_3; //引脚B3
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT; //输出
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; //速度
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; //推挽
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_Init(GPIOB,&GPIO_InitStruct);
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_7; //引脚D7
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT; //输出
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; //速度
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; //推挽
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_Init(GPIOD,&GPIO_InitStruct);
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6; //引脚 D6 = BUSY
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN; //输ru
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; //速度
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; //推挽
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_Init(GPIOD,&GPIO_InitStruct);
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
哦哦!!理解了,谢谢谢谢
一周热门 更多>