for me , i modify rushi53rushi53 code to use as switch p2.3 and p2.4 if pressed mean 0 , if release mean 1 . circuit input connect 100k resistor to port 2.3 and port 2.4 , each port 2.3 and 2.4 connect to a switch then to ground(GND).
for output led , cathode connect to a 330 ohm resistor anot connect to 5v VCC.
Code:
org 0000h
setb p2.3
setb p2.4
back: jnb p2.3,ledp13on
clr p1.3
clr p1.4
sjmp back
ledp13on: jnb p2.4,ledp14on
setb p1.3
clr p1.4
sjmp back
ledp14on: setb p1.3
setb p1.4
sjmp back
end
the led on when :-
p2.3=0 ,p1.3 led on
p2.3 & 2.4 =0 ,p1.3 & 1.4 led on
switch pressed = 0
switch release(no press) = 1
comment if something wrong i will reply as soon as possible