Society of Robots - Robot Forum

Software => Software => Topic started by: tmoney68 on August 13, 2010, 01:46:40 PM

Title: TICK_COUNT ...why?
Post by: tmoney68 on August 13, 2010, 01:46:40 PM
OK, been making some nice progress in my 'learning curve' but now have a question .... probably noob-ish, but still.

Why is TICK_COUNT used in appControl and appInitSoftware? I see it used in every snippet from Webbot and Admin, but don't understand why unless its hidden in the function call.  I've never used it when using the standard Setup() and Main() before. Is this specific to webbotlib?

Thanks for your patience in answering this.
Title: Re: TICK_COUNT ...why?
Post by: Razor Concepts on August 13, 2010, 02:03:50 PM
It's basically the main system time - when you schedule a function to run at a certain interval, the way the program knows when to execute it is through tracking the tick count. It is automatically incremented by a timer.
Title: Re: TICK_COUNT ...why?
Post by: Webbot on August 13, 2010, 07:14:40 PM
The TICK_COUNT (which is like a time of day in uS) is used in a number of ways:-

1. It can be a returned value - and this represents the 'delay' upon exit of the routine. ie if your appControl returns 10,000 then your appControl will be called every 10,000uS ie every 10ms

2. A TICK_COUNT is also passed into the functions to represent the time of day to save you having to call clockGetus.

Note that by 'time of day' I mean 'time since switched on'
Title: Re: TICK_COUNT ...why?
Post by: tmoney68 on August 14, 2010, 01:45:21 AM
Thanks guys. I figured it was a timing thing, just wasn't sure why it was utilised where setup() an main() would normally be