PDA

View Full Version : Paralel switches with a Rotary encoder



critix
- 17th June 2014, 11:25
Hi
I have the car radio volume turned by a rotary encoder.
I want to put in parallel two switches with 12F675 for up and down volume, from Satellite control wheel.
Can you help me with a code to simulate the encoder output?
Thanks

Demon
- 17th June 2014, 14:28
I would pull down GP4 and 5.

Google 2 bit rotary encoder tutorial, they are also called gray code I believe.

Robert


Edit: that is a weird rotary encoder, mine had power in. Yours seem to pull down the 2 lines, bizarre.

towlerg
- 17th June 2014, 14:51
@Demon I guess your's has power in so the pullups can be internal?

George

Demon
- 17th June 2014, 20:40
I used pulldowns on both encoder outputs, I never got into using pullups on PIC inputs.

Robert

Dave
- 18th June 2014, 11:37
With everything tied together at your "pin to the processor from radio" connection how do you think the direction will be determined? This schematic doesn't look quite right..
You need to have separate "A' and "B" lines so as to determine the knob direction as well as control it. Quadrature...

richard
- 18th June 2014, 13:12
if you look at the current in the circuit there are 4 possible states
1. 0
2. v/r3
3. v/r4
4. v/(r3+r4)paralleled
for the op's idea to work the original re must always come to rest (detent ) where the a b contacts are both o/c .
the pic must also leave the outputs in a high impedence state (ideally with pullups disabled) or the pic will interfere with the re action.
a cro image of the re pins at rest, rotating cw and rotating acw would make things easier