Search code examples
microcontroller8051

8051 port pin become high or not


Is there any way so we know which bit or pin is high or not in 8051 port without checking particular bit?

For example: P0.0 is become high.

I know the way by checking particular bits means P0.0.


Solution

  • You question is a little bit broad. Maybe you could use something like this:

    if (Port0 & 0x80)
    {
        ....                //Pin P0.7 is high
    }
    else
    {     
        ....                //Pin0.7 is low
    }