CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Softwartimer

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Doctor
Guest







Softwartimer
PostPosted: Sun Apr 03, 2005 5:14 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Apr 03, 2005 7:36 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Sun Apr 03, 2005 7:39 am     Reply with quote

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)
  {
  }
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group