各位老哥,这个程序的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)
{
} |