Help Debugging Code?

Hey, trying to get this program to work for the IRPD. It has been made off of the sample program from Lynxmotion’s IRPD Manual to test it with a micro controller. I’m having it give off a tone when something is there since I do not have a robot to work with. But the problem I have is that ‘templ’ and ‘tempr’ always equal 1, both when there is something there and when something is not. It sets to zero at the beginning so sometime before it goes through the ‘If’ commands it resets it to one. Any help would be much appreciated.

'IRPD test Program
templ var bit
tempr var bit
action var nib
pause 1000 'let IRPD settle
start:
templ = 0
tempr = 0
action = 0

high 8 :
pause 1000
templ = in12
low 8

high 15 :
pause 1000
tempr = in12
low 15

cont1:

if templ = 0 then 			
	action = action 
	pause 1000
else  						'object on left
	action = action + 1
	pause 1000
endif
pause 1000

cont2:

if tempr = 0 then			
	action = action
	pause 1000
else 						
	action = action + 2
	pause 1000
endif
pause 1000

cont3:
'action = 0, nothing in the way
'action = 1, something on front left side
'action = 2, something on front right side
'action = 3, something in front

branch action,  forward, turn_r, turn_l, backup ]
	forward:
		pause 1000
	goto start

turn_r:
sound 9, 150\2500 ]
pause 1000
goto start

turn_l:
sound 9, 150\3000 ]
pause 1000
goto start

	backup:
		sound 9,  150\3500 ]
		pause 1000
	goto start

First off I took out all of the pause 1000 cept one at the top. Your program was taking 10 seconds just to complete a single loop!!!

You were also testing for the wrong level from the IRPD.

This code works. Again, I had to change the pinouts to what my IRPD could connect to.

[code]'IRPD test Program
templ var bit
tempr var bit
action var nib
pause 1000 'let IRPD settle
start:
templ = 0
tempr = 0
action = 0

high 4
pause 1
templ = in6
low 4
pause 1

high 5
pause 1
tempr = in6
low 5
pause 1

cont1:
if templ = 1 then
action = action
else 'object on left
action = action + 1
endif

cont2:
if tempr = 1 then
action = action
else
action = action + 2
endif

'serout s_out, i38400, [dec action, 13]

cont3:
'action = 0, nothing in the way
'action = 1, something on front left side
'action = 2, something on front right side
'action = 3, something in front

branch action, forward, turn_r, turn_l, backup ]
forward:
goto start

turn_r:
sound 9, 150\2500 ]
goto start

turn_l:
sound 9, 150\3000 ]
goto start

backup:
sound 9, 150\3500 ]
goto start[/code]

Thank you very much, sorry forgot to take out pauses, using them to see where it was going when I was dugging some other things.