Im trying to make a variable timer using 4 input pins of my 12f675 pic but Im unable to read a voltage off Pins 0,1 and 4 for some reason. Pin 5 input functions as it should but cant read a logical 1 off the others. Programs written and programmed in Basic Pro using MPLabs.
Small program goes as follows, I added check for 0 on Pin0 to see if it was even configed as a input correctly. As I assumed I can get a longer delay if I check for 0 <so I am reading inputs I assume just not a logical 1>.
GPIO = %00111101
W0 VAR Word
W1 VAR Word
W2 VAR Word
W3 VAR Word
W4 VAR Word
B0 VAR Byte
loop:
W0 = 0
W1 = 0
W2 = 0
W3 = 0
Peek GPIO, B0
if B0.0 = 1 Then
W0 = W0 + 3000
Endif
if B0.0 = 0 Then
W0 = W0 + 24000
Endif
if B0.2 = 1 Then
W1 = W1 + 6000
Endif
if B0.4 = 1 Then
W2 = W2 + 12000
Endif
if B0.5 = 1 Then
W3 = W3 + 24000
Endif
W0 = W0 + 15000
High 1
Pause 200
Low 1
Pause W0
Pause W1
Pause W2
Pause W3
Goto loop
Originally all the inputs would add to W0 and the end result was added once more to 15K to ensure atleast a 15 second delay. I added the extra words and pauses to make sure I wasnt overwritting the pause<65K limit I believe>.
As for hardware Im using 4 10K resistors each in series with a SPST switch connected to ground. All inputs connected between the switch and resistor, 1 resistor and switch per input.
<aka HIGH on open LOW on closed>.
Any help will be greatly appreciated.