DSPRelated.com
Forums

GPIO interrupts configuration...

Started by Nitin Madhukar Yewale October 25, 2002
Hi,
I am using 56F827 in my project. One of the push button is
connected to one GPIO pin.
I want to execute two different operations when push button is
pressed. Operation to execute will be decided on the duration till which
button is pressed like....if button is pressed for 2 seconds then perfom
op_1 and else perform op_2.

As I know we can configure GPIO pin as
GPIO_INTERRUPT_DETECTION_ACTIVE_HIGH or
GPIO_INTERRUPT_DETECTION_ACTIVE_LOW [edge triggerd] to generate
interrupt.

Now I want to measure duration when button is pressed. How can I measure
the same?

My idea about implementation for the same:-

1> I will have to configure interrupt for
GPIO_INTERRUPT_DETECTION_ACTIVE_HIGH. So whenever user press the button
then it will go to ISR for GPIO pin.

2> When interrupt occurs then make GPIO_INTERRUPT_DETECTION_ACTIVE_LOW
and start timer so that start time is captured.

3> Now when user releses the button then control will go to ISR as new
setting i.e. GPIO_INTERRUPT_DETECTION_ACTIVE_LOW and we can stop the
timer.

Using above mechanism we can mesure the time for which user has pressed
button.

Correct me if I am wrong.
Regards,
Nitin


**************************Disclaimer************************************

Information contained in this E-MAIL being proprietary to Wipro Limited is
'privileged' and 'confidential' and intended for use only by the individual
or entity to which it is addressed. You are notified that any use, copying
or dissemination of the information contained in the E-MAIL in any manner
whatsoever is strictly prohibited.

***************************************************************************