View previous topic :: View next topic |
Author |
Message |
Doctor Guest
|
Softwartimer |
Posted: Sun Apr 03, 2005 5:14 am |
|
|
How can I create a Softwaretimer that counts exactly 10 seconds!
..so I can call up a function a the first second,
and end this function after ten seconds.
I mean
{
start timer
1 second
start function
10 seconds
end function
}
the function have to run throgh the 10 seconds, to get some values
Thx |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Sun Apr 03, 2005 7:36 am |
|
|
Neutone posted and you will find it in the Code Library
CCS Forum Index -> Code Library
The thread:
Timers to keep track of time and time events
Humberto |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sun Apr 03, 2005 7:39 am |
|
|
Search the forum, there plenty of examples on using timers. I would setup some timer to increment in some known unti, in this case, miliseconds.
Code: |
void main(void)
{
// Do initialization
// setup timer2 to int every milisecond
// you will have to search the forum or read the manual
// to find out how to do this
// Start counting
miliseconds = 0
// wait until the 1 second is up
while (miliseconds < 1000);
do_function();
// wait until the 10 seconds are up
while (miliseconds < 10000);
while(1)
{
}
} |
|
|
|
|