Hi guys,
I am a newbie to the forum and I hope that someone can help me keep what hair I have remaining.
I am trying to code a project with a Pic 16f877A that has a telephone style keypad with a dedicated keypad decoder chip for debouncing that provides a data valid signal for the interrupt function, an HD44780 based LCD module, and 40 relays for output.
The display shows a welcoming message until you press a key on the keypad, at which time it shows a different display with spaces prompting for more keys ( numbers ) to be entered. After the 3rd key is pressed, the code checks for validity and activates the appropriate relay for a set time duration.
I am using the PORTB,0 interrupt feature to detect keypresses.
I have been able to code each of the routines for the different functions successfully, but when I try to combine the code snippets, I run into problems with the system not responding to keypresses and/or the display showing garbage.
I am pretty sure that the multiple timing loops needed for the display are causing the processor to be tied up for too long in some cases which is causing it to miss keypresses and other events.
I am going to want to activate the watchdog timer function for the finished device, as well, which means that I may need the pre-scaler for it.
My thought is to use Timer 1 or 2 to handle the timing for the display functions and eliminate, or at least reduce the number of delay loops in the code. I expect that I would have to change the timer settings on the fly, depending what times I needed for the various functions and poll the overflow bit(s).
Does this sound like the best way to go?
Will there be a problem with using either or both of these timers for the delays?
How will the keypad interrupt affect the timer(s) as I am polling them?
Sorry for the long post.
Any help would be greatly appreciated.
Cheers,
Soundguy
I am a newbie to the forum and I hope that someone can help me keep what hair I have remaining.
I am trying to code a project with a Pic 16f877A that has a telephone style keypad with a dedicated keypad decoder chip for debouncing that provides a data valid signal for the interrupt function, an HD44780 based LCD module, and 40 relays for output.
The display shows a welcoming message until you press a key on the keypad, at which time it shows a different display with spaces prompting for more keys ( numbers ) to be entered. After the 3rd key is pressed, the code checks for validity and activates the appropriate relay for a set time duration.
I am using the PORTB,0 interrupt feature to detect keypresses.
I have been able to code each of the routines for the different functions successfully, but when I try to combine the code snippets, I run into problems with the system not responding to keypresses and/or the display showing garbage.
I am pretty sure that the multiple timing loops needed for the display are causing the processor to be tied up for too long in some cases which is causing it to miss keypresses and other events.
I am going to want to activate the watchdog timer function for the finished device, as well, which means that I may need the pre-scaler for it.
My thought is to use Timer 1 or 2 to handle the timing for the display functions and eliminate, or at least reduce the number of delay loops in the code. I expect that I would have to change the timer settings on the fly, depending what times I needed for the various functions and poll the overflow bit(s).
Does this sound like the best way to go?
Will there be a problem with using either or both of these timers for the delays?
How will the keypad interrupt affect the timer(s) as I am polling them?
Sorry for the long post.
Any help would be greatly appreciated.
Cheers,
Soundguy