Re: Wired remote for Pioneer HU
one thing I would make sure before connecting this to the car... measure the .spurious/floating) voltage on the tip pin when nothing it pluged.. if it's 12 volt you want to change some part of your hardware. Case it's 5 volts (or so), well there's no problem with your current solution
What you need to do is to clear the PORTB bits (to 0) and set your TRISB bits to 0 when you want to set a resistor to ground, and to 1 when you want to disconnect the resistor from the circuit. The more you clear TRSIB bits, the more resistor you add in parrallel. You should know how to calculate/evaluate resistors in parrallel, so, just etablish some value and work around this. Maybe you don't need more than 3-4 resistor to reproduce the whole value in the table above. If you feel lazy, then use 8 resistor and assign them to a whole 8 bits port. easier, need a bit more I/O... but easier. BTW you already get the idea as per your code.
8 resistors, 6 button = 14 I/O, a PIC 16F628 will do the trick without any need for a matrix keypad.
Code:
Button1 VAR PORTA.0
Button2 VAR PORTA.1
IF Button1=0 then set your resistor on portb
If Button2=0 then set your resistor on portb
.....
or
Code:
Button var PORTA
Select Case Button
Case xyz
Set yourresistor
Case abc
Set another resistor
....
How about that?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks