Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LPC1769 interrupt problem~

Status
Not open for further replies.

Wayne0809

New Member
I am doing a project using LPC1769. I intend to use an interrupt for a push button and initially everything is working. However, when I introduce a motor and printf() to my project, my program doesn't work as I expected. I connect L293D to port2 pin 4 and 5 GPIO of LPC to drive my motor and I using port1 pin 31 for my push button.When I run my program, the program like keep printing hello and interrupt to the EINT3 handler more than once when I press the push button. Attached is my C program,could anyone tell me what is going wrong? Is it the switch debouncing problem?Thank you:)
 

Attachments

  • main.c
    4.2 KB · Views: 601
Yes. You must debounce the button.

An easy technique is when the button is pressed, go into a loop and test the button every 1mS, and keep a count. When you get 50 consecutive presses (when the count >=50) you know the button was properly pressed for >50mS.

I also like to make sure the button is released (same process), before allowing it to be tested for pressed condition again.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top