I feel like I haven't been able to figure out anything recently, so alas, I am back to ask for more help.
I have another issue that popped up with some PIC18F45K20 programming, and I'm wondering if someone may be able to help. The code is for a PWM project that controls the brightness of two LED's. A standard 3-pin potentiometer is used to control the output duty cycle, but there's a twist: when the potentiometer is at center, there is no output; when the potentiometer is turned CW, PWM is output on RD5 and the LED lights up; when the potentiometer is turned CCW, PWM is output on RC2 and the other LED lights up.
This all works, except for one thing. I had to set up a "dead zone" in the potentiometer swing (slightly left and right of center) to avoid jitter in the outputs. When I turn the potentiometer I get variations in the ADC as follows:
0-450: RC2 output
451-574: Dead Zone, no output
575-1023: RD5 output
The problem is that I still get jitter at a certain point in the potentiometer swing because the ADC is going from say 448-452 rapidly between each instruction cycle, so the output "jitters" on and off, similar to button debouncing.
I've been pretty good at figuring stuff out with some simple suggestions from people, so maybe we can start there before I go posting a bunch of code. Has anyone encountered something similar, and if so, is there a method of fixing it? Thanks in advance
I have another issue that popped up with some PIC18F45K20 programming, and I'm wondering if someone may be able to help. The code is for a PWM project that controls the brightness of two LED's. A standard 3-pin potentiometer is used to control the output duty cycle, but there's a twist: when the potentiometer is at center, there is no output; when the potentiometer is turned CW, PWM is output on RD5 and the LED lights up; when the potentiometer is turned CCW, PWM is output on RC2 and the other LED lights up.
This all works, except for one thing. I had to set up a "dead zone" in the potentiometer swing (slightly left and right of center) to avoid jitter in the outputs. When I turn the potentiometer I get variations in the ADC as follows:
0-450: RC2 output
451-574: Dead Zone, no output
575-1023: RD5 output
The problem is that I still get jitter at a certain point in the potentiometer swing because the ADC is going from say 448-452 rapidly between each instruction cycle, so the output "jitters" on and off, similar to button debouncing.
I've been pretty good at figuring stuff out with some simple suggestions from people, so maybe we can start there before I go posting a bunch of code. Has anyone encountered something similar, and if so, is there a method of fixing it? Thanks in advance