while程序不运行,引脚点灯

2019-07-20 00:37发布

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);
}




友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
2条回答
sd695162689
1楼-- · 2019-07-20 05:30
 精彩回答 2  元偷偷看……
洋春白雪
2楼-- · 2019-07-20 08:12
sd695162689 发表于 2019-7-16 09:35
应该不是不运行,是运行的。
我不知道1灯是开还是0是开灯。假设1是开灯,开灯亮起延时,人看得到,等于0, ...

哦哦!!理解了,谢谢谢谢

一周热门 更多>