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.

PIC18F452 & ADC --> no interrupts : is it right ?

Status
Not open for further replies.

ZERS

New Member
Hi,

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.

Is it true ? :oops:
 

Attachments

  • buttons_schematic.sized.zip
    29.8 KB · Views: 459
ZERS said:
Hi,

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.

Is it true ? :oops:

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?.
 
Hi,

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.

Is it true ?

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.
 
Nigel Goodwin said:
Why do you particularly need keys to generate an interrupt?.

Hi,

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.

Is there any other way to perform this ?
 
motion said:
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.
Interesting...
 
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.

Is there any other way to perform this ?

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.
 
ZERS said:
Nigel Goodwin said:
Why do you particularly need keys to generate an interrupt?.

Hi,

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.

Is there any other way to perform this ?

I don't think there's probably much action happening in the processor while playing CD's, so you should be able to poll the buttons quite easily.

Here's a site using a 16F877 for a CD player with a PC CDROM drive
**broken link removed**
, it also uses the ADC for reading the buttons.
 
Nigel Goodwin said:
I don't think there's probably much action happening in the processor while playing CD's, so you should be able to poll the buttons quite easily.
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
**broken link removed**
, it also uses the ADC for reading the buttons.

Thanks I will look into that :)
 
I do apologize for my BAD english :oops: , but i don't understand this sentence :
motion said:
This also acts as a natural key switch debounce filter.

What do you mean exactly ?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top