input portd.7
input portd.6
input portd.5
main:
if portd.7=1 then
if portd.6=1 then
if portd.5=1 then
high portc.1
high portc.2
high portc.3
else
high portc.0
Low portc.1
low portc.2
low portc.3
endif
else
high portc.0
Low portc.1
low portc.2
low portc.3
endif
else
high portc.0
Low portc.1
low portc.2
low portc.3
endif
goto main