This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc3200 systic问题



各位朋友,现在我想用systick每毫秒中断一次,自己写了一个中断倒是可以用。

我想知道,TI官方的库函数里面有没有类似可以得到目前systick值的函数,我从systick里找到了一个

和想知道他返回的是个什么值

unsigned long
SysTickValueGet(void)
{

  return(HWREG(NVIC_ST_CURRENT));
}

于是我用串口把它每30ms打印出来UART_PRINT("systic is %lu \r\n",SysTickValueGet()); 得到的数值是乱的,有时候大有时候小。

我自己写的就没有问题

int SYSTICK_Count=0;

//************************************************
//sistick中断函数
//***********************************************
void systickIntHandler()
{
//flag++;
SYSTICK_Count++;//一毫秒变量加一
//GPIO_IF_LedToggle(MCU_RED_LED_GPIO);
}

//***********************************************
//systick init
//***********************************************
void Systick_Init()
{

SysTickIntRegister(systickIntHandler);

SysTickPeriodSet(1);

SysTickIntEnable();
SysTickEnable();
}


//**********************************************
//return the value of systick
//**********************************************
int get_systick()
{

return SYSTICK_Count;

}

  • 明确:定时器24bit,时钟频率 80MHZ,向下计数,中断函数不用清除中断标志位,没有分频功能, 自动装载。

    SysTickIntRegister(SysTickHandle);

    SysTickPeriodSet(8000000);

    SysTickIntEnable();

    SysTickEnable();

    void SysTickHandle(void)

    {

    }