I have one switch and one LED. the positive edge of switch is connected to port pin PO.1 and negative edge is connected to port pin PO.2 and LED is connected to output the positive edge of motor is connected to port pin P1.1 and negative edge is connected to P1.2
if switch is on then LED is on
if switch is of then LED is of
I am trying to make assembly code please check out code
if switch is on then LED is on
if switch is of then LED is of
I am trying to make assembly code please check out code
Code:
org o h
main:
jb P0.1, on
jb P0.2, on ; switch is closed
jnb P0.1, off ; switch is open
jnb P0.2, off
sjmp main
ON:
setb P1.1 ; led on
clr P1.2
sjmp main
OFF:
clr P1.1 ; led off
clrP1.2
sjmp main
end