I am working on a board which comprises LPC1768 microcontroller. All I want to do is to create an accurate time delay using osdelay function of CMSIS RTOS API. I have set my systick time tick count to 10000.But when I use osdelay(1000) in my thread, it doesn't creates delay period of 1 second as it should do !
Here is the source code
#include"cmsis_os.h"
#include"lpc17xx.h"
void Thread1 (void const *argument) {
while (1) {
LPC_GPIO2->FIOPIN = 0x00000001;
osDelay(1000);
LPC_GPIO2->FIOPIN = 0x00000000;
osDelay(1000);
}
}
osThreadId main_ID,led_ID1,led_ID2;
osThreadDef(Thread1,osPriorityNormal, 1, 0);
int main (void)
{
SystemInit();
LPC_PINCON->PINSEL4 = 0x00000000;
LPC_GPIO2->FIODIR = 0xffffffff;
osKernelInitialize ();
led_ID1 = osThreadCreate(osThread(Thread1), NULL);
osKernelStart ();
}
Now, my problem is with osdelay(1000) not providing a delay of 1000ms as it should do with systick timer tick value set to 1000.