I need to connect several buttons to my pic18F452 It seems that using the ADC will be the way to do that. The schematic is attached.
But I've been heard that with such a circuit, it would not be possible to program using interrupts, i.e. each time a button is pressed, the µC would not detect any interrupts.
I need to connect several buttons to my pic18F452 It seems that using the ADC will be the way to do that. The schematic is attached.
But I've been heard that with such a circuit, it would not be possible to program using interrupts, i.e. each time a button is pressed, the µC would not detect any interrupts.
I would have thought so, you're not pressing anything that could cause an interrupt - however, the ADC completing a conversion can generate an interrupt, the routine servicing it could check easily for a pressed key. But this would mean only a very occasional interrupt actually servicing a key.
Why do you particularly need keys to generate an interrupt?.
I need to connect several buttons to my pic18F452 It seems that using the ADC will be the way to do that. The schematic is attached.
But I've been heard that with such a circuit, it would not be possible to program using interrupts, i.e. each time a button is pressed, the µC would not detect any interrupts.
Using the ADC will not prevent the PIC from detecting interrupts. However, if the AD conversion uses interrupts, other interrupts will be masked while servicing an interrupt.
The PIC18F452 has the advantage over older generation PICs that it has a dual priority interrupt option. This means a lower priority interrupt service routine can be interrupted by a higher priority one if the dual priority interrupt feature is enabled.
this for a CD controlling board. The buttons will be used to manage a CD through the controller (PIC) :wink:
That's the reason why I need to look up interrputs while the CD is playing. Each time one button is pressed, I will send the related command to the cd.
Using the ADC will not prevent the PIC from detecting interrupts. However, if the AD conversion uses interrupts, other interrupts will be masked while servicing an interrupt.
This is not a big issue since the interrupts generated by the ADC will be the only ones :wink:
motion said:
The PIC18F452 has the advantage over older generation PICs that it has a dual priority interrupt option. This means a lower priority interrupt service routine can be interrupted by a higher priority one if the dual priority interrupt feature is enabled.
That's the reason why I need to look up interrputs while the CD is playing. Each time one button is pressed, I will send the related command to the cd.
Pushbutton presses are really low speed events. If you can poll the pushbuttons say 20 times/second, a person will not detect any lag in response. This also acts as a natural key switch debounce filter.
this for a CD controlling board. The buttons will be used to manage a CD through the controller (PIC) :wink:
That's the reason why I need to look up interrputs while the CD is playing. Each time one button is pressed, I will send the related command to the cd.
Well, the actions are quite simple : the µC receives informations from the drive (such as track #, elapsed time, ..) and has to display them. While performing this, it has to check whether a pushbutton is pressed. That's the reason why, interrupts may be adequat.
Nigel Goodwin said:
Here's a site using a 16F877 for a CD player with a PC CDROM drive