This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to read port pins in port(P0,1,2)?

I would like to call function like port(P0,1,2).i want to assign the values of 0 and 1 to P0.1 and P0.2 using that function prototype only...how can i assign the values to port pins.what are the steps i need to follow...

Thanks in advance

chinnaye

Parents
  • How to read port pins in port(P0,x1,x2)?

    temp1 = 1 <<= x1
    
    temp2 = 1 <<= x2
    temp2 |= temp1
    temp3 = p0
    temp3 &= temp2
    return (temp3)
    

    the above describe the needed process maybe not the most elegant way, but that (1 <<= x2) is the only way you can process port pins defined in a function header.

    since you refuse to accept the inability to indirectly address bits, BEFORE YOU POST AGAIN study (I did not say 'read') "the bible" chapter 2. www.8052.com/.../120112

    Erik

Reply
  • How to read port pins in port(P0,x1,x2)?

    temp1 = 1 <<= x1
    
    temp2 = 1 <<= x2
    temp2 |= temp1
    temp3 = p0
    temp3 &= temp2
    return (temp3)
    

    the above describe the needed process maybe not the most elegant way, but that (1 <<= x2) is the only way you can process port pins defined in a function header.

    since you refuse to accept the inability to indirectly address bits, BEFORE YOU POST AGAIN study (I did not say 'read') "the bible" chapter 2. www.8052.com/.../120112

    Erik

Children