pga2310 and switch bounce

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
I am using the PIC16F877A to control ti's PGA2310 volume chip. I am going to use an optical encoder to control the volume, but I'm testing everything out with pusbuttons first. Everything is seems to be working, but the volume changes aren't smooth- the amplitude will jump over large gaps instead of steadily increase.

I think that switch-bounce could be the problem- I have the pushbuttons causing a PORTB interrupt, then a 25ms time delay to account for bounce before continuing with the code, but the output still jumps erratically.

Does anyone have any suggestions/related experiences?

Thanks alot.

Brian.
 
I'm not sure if this is defianatly the case for the PIC micro controlers, but if you are using an interupt you will generaly have the device run the coad for the interup when it occurs and bump any running code out of the way untill it is finished.

So, what this may mean is that for each bounce on the swithc, one interupt is being aclled, wich will form a sort of que of all of the button presses and delays and not just one button press followed by a delay which you want.

If this is the broblem you are encountering, if you change they delay code slightly, so that at the start of the delay the interupt function is disabled, and then enable it at the end of the delay agin for another button press.

edit:

you might also want to consider what happens when the button is held down, as this may also be causing the problem (you will almost certinaly keep the button pressed down for more than 25ms when you press it) as it is recording multiple presses for each push, even if the bounce is being removed.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.