Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Read the on-line reference articles A Guide to Debouncing by Jack Ganssle (part I and part II,http://www.ganssle.com/debouncing.htm). Write a subroutine to read the logical state

Read the on-line reference articles A Guide to Debouncing by Jack Ganssle (part I and part II,http://www.ganssle.com/debouncing.htm). Write a subroutine to read the logical state of the input pin associated with the button (open or closed) and return the debounced button state. To check (read the pin state) use

P2->IN & BIT4

If this is 1 it means that the pin on Port2 Bit 4 is high. Normally the pin is high (Pulled up) and when the button is pressed it goes low (more about this in the coming lectures)

  1. Your subroutine must handle switch bounce. When your subroutine detects a button press, it should delay for an appropriate number of milliseconds (5ms) before checking the state again to ensure that the state has not changed. For now we will use the built-in delay function delay_cycles ( );

  2. Write your delay function so that you can adjust the delay to accommodate longer or shorter switch bounce times as appropriate.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago