void TimeHandler()
{
semGive();
}
I want to know, if I change sentence (1) into
taskDelay(sysClkRateGet()), and get rid of the TimerHandler. It seems
that the two solution both can handle the problem, but if there's any
difference?
Best regards
Case 2: TaskDelay(1 ms) + your code time + taskDelay(1ms) + ...
There is a time shift.
Charly
the difference is:
- with TimeHandler() you'll stay synchronized. Even if the job execution
time has a jitter that might exceed 1s sometimes, two rounds will be taken
within 2 seconds. If you use a counting semaphore, multiple jobs exceeding
1s in sequence are allowed and still the whole system will synchronize after
some turns.
- with taskDelay(sysClkRateGet()) you will get out of 1s sync if jobExecTime
> tickTime (i.e.. not 1s!). This 'out of sync' will accumulate for evey job
that executes longer than one system tick.
You should not assume that your job is always guaranteed to finish within
one tick, as there might be an higher priority task or an interrupt
occupying the CPU outside your control. Assumptions like 'time will be
enough' are sometimes the first step to trouble ;-)
The second version is simpler, the first is more accurate. You'll have to
decide yourself which one serves your needs.
--
Regards,
Michael
21 is only half the truth.
FAQ - "http://www.xs4all.nl/~borkhuis/vxworks/vxworks.html"
Wiki -
"http://www.bluedonkey.org/cgi-bin/twiki/bin/view/Books/VxWorksCookBook"
"Yao Yong" <yy_un...@hotmail.com> schrieb im Newsbeitrag
news:cfe430d0.03091...@posting.google.com...
Thanks a lot!