how to use

i was wandering how to use the timer in EasyC. i need to be able to stop my program after four min. can someone tell me how to do this.

The following is just pseudo code, but it’d look something like below. You’d probably need to deal with “4 minutes” in a much larger increment like seconds or 10ths of a second, but that is just simple maths.

while (timer <= 4 minutes) {
  code here;

well the timer works in milliseconds and don’t forget to make a variable (unsigned long) for the timer to store it’s data. so the code fryfrog posted is pretty good but were he has timer you would have your variable title.

I think the milliseconds value is 240,000.
Good luck with your code!

indeed it is

what i need to know is how i can put the timer into the program…do i need a start timer? do i have to have a get timer? Why dose the start/stop timers not include variables?

other than that i know how to wright the program.

thx for everything

I can’t give you the specific answers to your questions, but I would suggest looking in the help files on EasyC for information on using timers. The help files are a good source of useful information and should answer your questions.

Simply drag a timer block into your program, open it up, and click the help button.

The Start has no variable because all it does is initialize the timer.
The Stop has no variable because all it does is stop the timer.

The variable in the Get timer, just gets the timers current value and stores it to a variable that can be used in your code.

I Have not used EasyC for some time so i dont remember all of teh commands exactly, but the code should go something like this.

int Time;


While ( 1==1 )
    While ( Time < 240000)
        //Code Goes Here