Help with timer structure


hello friends!
i newbie, have arduino , have following problem:
science don't use delay function timming, use more real-time functions, plc's have.
what tried create timer structure, following members:
en-enable (active long conditions true)
tt-timer timing (active long timer counting, not reached preset value)
dn - done (active when condition on , accumulated value reached preset value).
i try calculate accumulated value registering time before , after acc value calculation, this:

     start_time = micros();
     timer1_acc = timer1_acc + start_time - end_time;
     end_time = micros();

seems work, result not accurate @ all. 4 times bigger shoult be,probably becouse can return me multimples of 4 , scan seen being microsec, counts 4. don't know bahaviour on bigger programs.
did of try similar?

can implemented in library?

best regards!



Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Help with timer structure


arduino

Comments