Switch Debounce using PIC16F690 Microcontroller

In summary, the homework problem involves writing a software solution for switch debounce in Assembly and testing it on the LPC demo board of the PICKit2 using a push button connected to the MCLR pin of the PIC16F690 chip. The program should show the effect of pressing down and releasing the button on an LED. The provided code includes a 5ms delay loop, but when tested, the LED did not respond to the button.
  • #1
Abstr7ct
22
0

Homework Statement



I'm having a lab problem for PIC16F690 chip. It's needed to write a software solution of switch debounce in Assembly and test the code on the LPC demo board of the PICKit2 using the push button that's connected to the MCLR pin of the chip. The effect of pushing down (ON)/releasing (OFF) the button should be seen on an LED. Here's a picture of the procedure of the program.

mbu9s8.jpg


Homework Equations



None

The Attempt at a Solution



I've attached my latest attempt of the code in a txt file. The loop that I created is a 5ms delay as stated in the program procedure.
 

Attachments

  • code.txt
    1.6 KB · Views: 473
Last edited:
Physics news on Phys.org
  • #2
The LED should turn off/on every time the button is pressed. However, when I tested the code on the board, the LED stayed off and no response was detected from the button.
 

What is switch debounce and why is it important in microcontroller programming?

Switch debounce is the process of eliminating or reducing the effects of multiple or false button presses when a switch or button is pressed. This is important in microcontroller programming because it ensures that the microcontroller correctly interprets a single button press, leading to more accurate and reliable results.

How does switch debounce work in a PIC16F690 microcontroller?

The PIC16F690 microcontroller has a built-in hardware debounce feature, which uses a capacitor and a resistor to filter out any bouncing effects of the switch. This allows for a clean and stable signal to be sent to the microcontroller, ensuring accurate button press detection.

What is the process for implementing switch debounce in a PIC16F690 microcontroller?

The process for implementing switch debounce in a PIC16F690 microcontroller involves configuring the hardware debounce feature, which can be done through the microcontroller's input/output ports. The input pins connected to the switch should be set as digital inputs with internal pull-up resistors enabled, and the debounce feature should be enabled through the configuration registers.

What are the potential challenges or issues that can arise when using switch debounce in a PIC16F690 microcontroller?

Some potential challenges or issues that can arise when using switch debounce in a PIC16F690 microcontroller include incorrect debounce settings, which can lead to false button presses or missed button presses. Additionally, if the switch is not properly connected or there is noise in the circuit, the debounce feature may not work effectively.

Are there any alternative methods for switch debounce in microcontrollers?

Yes, there are alternative methods for switch debounce in microcontrollers, such as using software-based debounce algorithms. These algorithms can be implemented in the microcontroller's code and can provide more flexibility in terms of debounce settings and customization. However, hardware debounce features, like the one in the PIC16F690, are often more reliable and efficient.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
11
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
14
Views
5K
  • Introductory Physics Homework Help
Replies
1
Views
2K
Replies
6
Views
6K
Replies
5
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
Replies
9
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
Back
Top