Hey all,
A while back I posted about some center tapped potentiometers I came across, and I'm finally getting around to using them. I'm trying to use the configuration shown to control the brightness of two LED's with PWM. The two LED's are each on a different output (RC2 and RD5 on a PIC18F45K20) with the switching being done by high-side MOSFETs...but that's not important right now
My main issue is coming up with a way for the microcontroller to be able to tell the difference between turning the potentiometer CW and CCW. Details: when the potentiometer is at center, the voltage at the wiper is zero. When the shaft is rotated CW, the voltage increases from 0 to 3.3V. The same thing occurs when the shaft is rotated CCW. This analog voltage is being read through the A/D of the PIC, which controls the duty cycle of the output PWM.
So, the problem is that the PIC doesn't know whether to output to RC2 or RD5 because the input voltage at the A/D varies from 0-3.3V no matter which direction the pot is turned. Does anyone have any ideas on how to make the PIC differentiate the two?
It may seem like a trivial task, but it's a task nonetheless . I think I'm having one of these moments
A while back I posted about some center tapped potentiometers I came across, and I'm finally getting around to using them. I'm trying to use the configuration shown to control the brightness of two LED's with PWM. The two LED's are each on a different output (RC2 and RD5 on a PIC18F45K20) with the switching being done by high-side MOSFETs...but that's not important right now
My main issue is coming up with a way for the microcontroller to be able to tell the difference between turning the potentiometer CW and CCW. Details: when the potentiometer is at center, the voltage at the wiper is zero. When the shaft is rotated CW, the voltage increases from 0 to 3.3V. The same thing occurs when the shaft is rotated CCW. This analog voltage is being read through the A/D of the PIC, which controls the duty cycle of the output PWM.
So, the problem is that the PIC doesn't know whether to output to RC2 or RD5 because the input voltage at the A/D varies from 0-3.3V no matter which direction the pot is turned. Does anyone have any ideas on how to make the PIC differentiate the two?
It may seem like a trivial task, but it's a task nonetheless . I think I'm having one of these moments