switch A is connected to P0.1
switch B is connected to P0.2
LED is connected to P1.0
IF one switch or both high then the LED is turn on otherwise turn off
switch A high then turn on LED
switch B high then turn on LED
both A B high then turn on LED
both A B low then turn off led
I want to write assembly program using OR logic statement
How to write statement for OR logic for switches
use ORL command. one more thing is that all logical operation can perform only with acc.
and for your program first move P0.1 to cy flag by MOV C,P0.1 then ORL C,P0.2
(if you are new to 8051 then you can refer book "The 8051 Microcontroller and Embedded Systems Using Assembly and C by Mazidi and Mazidi")
you can write logical statements as per bit operation or jump operation like jb,jbc,jc,jnb,jnc,jnz
and you also can use compare instruction to compare.
but you should go through instruction first because you can write any logical or mathematical operation using assembly.
because intelligent compiler do same.
switch A is connected to P0.1
switch B is connected to P0.2
LED is connected to P1.0
IF one switch or both high then the LED is turn on otherwise turn off
switch A high then turn on LED
switch B high then turn on LED
both A B high then turn on LED
both A B low then turn off led
I want to write assembly program using OR logic statement
How to write statement for OR logic for switches