高手看看这个代码哪里不对了?
时间:10-02
整理:3721RD
点击:
#include <LPC17xx.H>
uint32_t msTicks,sign = 0;
void sysTick_Handler(void)
{
msTicks++;
if(msTicks == 30)
{
sign = 1;
msTicks = 0;
}
}
int main(void)
{
uint32_t SystemCoreClock = 0;
uint32_t i = 29;
// SystemInit();
if(SysTick_Config(SystemCoreClock / 1000))
{
while(1);
}
LPC_PINCON->PINSEL1 |= 0xc3ffffff;
LPC_GPIO0->FIODIR |= 0x60000000;
// LPC_GPIO0->FIOSET3 |= 0x60;
while(1)
{
if(sign == 1)
{
sign = 0;
LPC_GPIO0->FIOPIN |= -(1<<i);
i++;
if(i == 30);
i=0;
}
}
}
uint32_t msTicks,sign = 0;
void sysTick_Handler(void)
{
msTicks++;
if(msTicks == 30)
{
sign = 1;
msTicks = 0;
}
}
int main(void)
{
uint32_t SystemCoreClock = 0;
uint32_t i = 29;
// SystemInit();
if(SysTick_Config(SystemCoreClock / 1000))
{
while(1);
}
LPC_PINCON->PINSEL1 |= 0xc3ffffff;
LPC_GPIO0->FIODIR |= 0x60000000;
// LPC_GPIO0->FIOSET3 |= 0x60;
while(1)
{
if(sign == 1)
{
sign = 0;
LPC_GPIO0->FIOPIN |= -(1<<i);
i++;
if(i == 30);
i=0;
}
}
}
void SysTick_Init(void)
{
if (SysTick_Config(SystemCoreClock / 100000))
{
/* Capture error */
while (1);
}
// 关闭滴答定时器
SysTick->CTRL &= ~ SysTick_CTRL_ENABLE_Msk;
}
