real-time clock in code composer

Jan 20, 2016 21 Replies

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

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

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required