打印

while循环不起来

[复制链接]
333|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
各位老哥,这个程序的while为什么循环不起来,三个灯轮流亮一遍就停在最后一个灯了,求解!!

#include "stm32f10x.h"
void delay_us(u16 time)
{   
   u16 i=0;  
   while(time--)
   {
      i=10;  //自己定义
      while(i--) ;   
   }
}
//毫秒级的延时
void delay_ms(u16 time)
{   
   u16 i=0;  
   while(time--)
   {
      i=12000;  //自己定义
      while(i--) ;   
   }
}
int main ()
{
while(1)
{
*(unsigned int *)0x40021018 |=(1<<3);
*(unsigned int *)0x40010c00 |=((1)<<(4*5));
*(unsigned int *)0x40010c0c &=~(1<<5);
delay_ms(100);
*(unsigned int *)0x40021018 |=(1<<3);
*(unsigned int *)0x40010c00 |=((1)<<(4*1));
*(unsigned int *)0x40010c0c &=~(1<<1);
delay_ms(100);
*(unsigned int *)0x40021018 |=(1<<3);
*(unsigned int *)0x40010c00 |=((1)<<(4*0));
*(unsigned int *)0x40010c0c &=~(1<<0);
delay_ms(100);
}
}
void SystemInit (void)
{
}

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

377

主题

377

帖子

0

粉丝