野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 16514|回复: 1

望指点,就下面一个简单的函数,为什么灯老是亮灭亮灭呢?

[复制链接]
发表于 2019-4-2 20:20:30 | 显示全部楼层 |阅读模式
本帖最后由 我想搞32 于 2019-4-2 20:21 编辑

就这一个简单的函数为什么它老是亮灭亮灭。像加了while循环一样呢


int main()

{
GPIO_InitTypeDef GPIO_InitSt;

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
GPIO_InitSt.GPIO_Mode =GPIO_Mode_Out_PP;
GPIO_InitSt.GPIO_Pin= GPIO_Pin_2;
GPIO_InitSt.GPIO_Speed =GPIO_Speed_50MHz;
GPIO_Init(GPIOC,&GPIO_InitSt);


  delay_init();

  GPIO_ResetBits(GPIOC,GPIO_Pin_2);
  delay_ms(1000);
  GPIO_SetBits(GPIOC,GPIO_Pin_2);
  delay_ms(1000);
}


回复

使用道具 举报

发表于 2019-4-3 00:11:10 来自手机 | 显示全部楼层
因为main结束后会从头执行
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2025-12-7 01:17 , Processed in 0.039993 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表