Is there an App to create a Delay uSec function?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MaxECU
Employee
Employee
Welcome!
Looking at the System Timer application, I do not find any App that could provide a simple Delay_usec(uint32_t uiUs) function? Is there any possibility without using RTOS?
0 Likes
5 Replies
MaxECU
Employee
Employee
Welcome!
thanks, I have solved by using SYSTM002 APP. Here my code:

void delayMicroseconds(uint32_t dwUs)
{
handle_t TimerId;

bTimerExpired = FALSE;

/*
* This funcion uses SysTick Exception for controlling the timer list. Call back function
* registered through this function will be called in SysTick exception when the timer is expired.
* One shot timers are removed from the timer list, if it expires. To use
* this SW timer again it has to be first deleted and then created again.
*
* @param[in] Period Timer period value in microseconds
* @param[in] TimerType Type of Timer(ONE_SHOT/PERIODIC)
* @param[in] TimerCallBack Call back function of the timer(No Macros are allowed)
* @param[in] pCallBackArgPtr Call back function parameter
*/
TimerId = SYSTM002_CreateTimer(dwUs,SYSTM002_ONE_SHOT,m_Timer,NULL);
if(TimerId != 0)
{
//Timer is created successfully
SYSTM002_StartTimer(TimerId);

// Wait until timer expires
while (!bTimerExpired)
;
// Delete Timer since is One-Shot
SYSTM002_DeleteTimer(TimerId);
}
}

where 'm_Timer' is;
void m_Timer(void* Temp)
{
bTimerExpired = TRUE;
}
0 Likes
Not applicable
I think this is not the right way to create a microsecond timer.
The functions are depending on the systick that is normally a millisecond timer.

you should check if this function Returns realistic values in microseconds.
Using the sample in the link is much easier and it delivers true microseconds without any Interrupts.
0 Likes
MaxECU
Employee
Employee
Welcome!
ok, thanks!
0 Likes
User18713
Level 1
Level 1
Actually I am new in DAVE so I can't find anything for delaying any PWM so please guide me if RTOS make a delay function, i dont know how to use RTOS app i.e FREERTOS app.
0 Likes