TIMER + button

General discussion on mikroPascal PRO for AVR.
Post Reply
Author
Message
AlexanderRUS
Posts: 24
Joined: 30 Jul 2013 11:51

TIMER + button

#1 Post by AlexanderRUS » 15 Jan 2014 05:52

All good morning. It is impossible to make some functions on one button being divided time. If the button is pressed less than 3 seconds, we carry out one action if the button is pressed more than 3 seconds, other action. For this purpose I use procedure Timer0Overflow_ISR (); org IVT_ADDR_TIMER0_OVF; but intervals of time aren't constant.

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: TIMER + button

#2 Post by marina.petrovic » 15 Jan 2014 16:30

Hi,

You can do something simple: you need to have some counter (which will count up to 3s)
and then "ask" if it is higher than 3s and execute the appropriate action.

If you want to use timer interrupts, please take a look at Timer Calculator from LibStock Website:
http://www.libstock.com/projects/view/3 ... calculator

Timer Calculator is a free software development tool used for easier calculation of timer interrupts.

Best regards,
Marina

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: TIMER + button

#3 Post by Dany » 16 Jan 2014 21:03

Perhaps the (mP and mB) library "Button_Utilities" (http://www.libstock.com/projects/view/39/utilities) can be of some help.
See http://www.rosseeld.be/DRO/PIC/Button_Utils.pdf for the documentation, see the "Timed Functionality".

The Button_Utilities library uses the "Timers" library, which you can find here: http://www.libstock.com/projects/view/103/schedulers.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

AlexanderRUS
Posts: 24
Joined: 30 Jul 2013 11:51

Re: TIMER + button

#4 Post by AlexanderRUS » 17 Jan 2014 05:24

Hi!!! Timer Calculator helped me. Big ALL THANKS

Post Reply

Return to “mikroPascal PRO for AVR General”