Hello,
I have a problem with CMSIS-RTOS RTX.
My program works through the main()-function and after that it jumps to the Timer_Callback()-function. I didn't understand why I must define a timerDelay?
I thouhgt, that if I define a timerDelay for example 10.000 milliseconds, my program jumps every 10 seconds into the Timer_Callback()-Function, but it isn't so, it jumps every second into the Timer_Callback()-function.
I hope I could explain my problem and anyone can help me and I apologize in advance for my bad english.
Here is my source-code:
#include "LPC43xx.h" #include "Board_GLCD.h" #include "GLCD_Config.h" #include "cmsis_os.h" #include <stdio.h> #define STRINGBUF_LEN 21 extern GLCD_FONT GLCD_Font_16x24; char StringBuf[STRINGBUF_LEN]; void Timer_Callback(void const *arg); osTimerDef(Timer, Timer_Callback); uint32_t exec; volatile int i = 0; void Timer_Callback(void const *arg) { sprintf(StringBuf, "Access: %d", i); GLCD_DrawString(0, i*24, (char*)StringBuf); i++; } int main(void) { osTimerId id; osStatus status; uint32_t timerDelay; GLCD_Initialize(); GLCD_SetFont (&GLCD_Font_16x24); GLCD_DrawString (0, 0*24, " "); GLCD_DrawString (0, 1*24, " "); GLCD_DrawString (0, 2*24, " "); GLCD_DrawString (0, 3*24, " "); GLCD_DrawString (0, 4*24, " "); GLCD_DrawString (0, 5*24, " "); GLCD_DrawString (0, 6*24, " "); GLCD_DrawString (0, 7*24, " "); GLCD_DrawString (0, 8*24, " "); GLCD_DrawString (0, 9*24, " "); exec = 2; id = osTimerCreate(osTimer(Timer), osTimerPeriodic, &exec); if(id != NULL) { timerDelay = 10000; // ??????????????????????????????????????????? status = osTimerStart(id, timerDelay); if(status != osOK) GLCD_DrawString(0, 8*24, "Timer: not started"); else GLCD_DrawString(0, 9*24, "Timer: started"); } }