新手上路
- 积分
- 25
- 金钱
- 25
- 注册时间
- 2019-6-5
- 在线时间
- 5 小时
|
1金钱
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#楼]
应该不是不运行,是运行的。
我不知道1灯是开还是0是开灯。假设1是开灯,开灯亮起延时,人看得到,等于0,没有延时人看不到
然后程序又到开头的1,灯又亮起。从视觉角度没变化(=没运行)
|