real-time clock in code composer

A button is an unfriendly thing from the processor viewpoint. When closing, it always bounces for some milliseconds and feeds multiple closing signals to the processor. Most buttons do the same on opening.

You'd be better off if you polled the button in regular intervals and trusted the output when there are sufficiently many same states read after each other. The common method is to have the intervals from a timer interrupt.

--

-TV
Reply to
Tauno Voipio
Loading thread data ...

Here is a link to examples how to deal with bouncing on buttons/switches

formatting link

Maybe Nikola will look into it and implement one of solutions.

-- AM

If

he

d
w

've

e

in

rupt routine for buttons,and second one periodically checks the state of pi ns where are buttons. I have question for first version. Can I use flags as conditions for each button in interrupt routine,e.g. #pr agma vector=PORT2_VECTOR

that way of interrupt routine make sense? Thanks

Reply to
Adam M

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.