Page 1 of 1
Keypad wait interrupt
Posted: Wed Jun 01, 2016 6:52 pm
by paridhi
I do not want to wait for the input for long time. If the input is there in keypad its fine, else the program must carry on. What should I do make such program?
Re: Keypad wait interrupt
Posted: Thu Jun 02, 2016 3:55 pm
by Benj
Hello,
The Interrupt On Change (IOC) type interrupt can be used to detect a I/O change.
However a keypad is generally raster scanned so probably won't work with the IOC interrupt unless you get the changing voltage to be made present to the micro via your circuitry.
A lot of devices would wait for up to say 30 seconds for input before resuming with what they were doing.
This can be done by incrementing a counter in a loop every time there is no keypress along with a delay. If the counter reaches a certain value then x amount of time has passed and you can drop out of the loop and go back to what you were doing before. By placing this type of code into a macro you can call it in several places in your program without repeating the same code over and over again.