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
In the above case,i need to assign the values for two pins of same port.what are the steps to do that??
i want to use function is
ping(port,number1,number2) Here every pin is switchable by the user.
Thanks in Advance
"what are the steps to do that?"
It is your project; you are the programmer - so it is really your job to think about that!
Think about what standard facilities the 'C' programming language provides to do such things;
Read the Keil C51 Compiler Manual to see if there are any proprietary language extensions to help you.
"i want to use function is"
ping( port, pin_number1, pin_number2 )
So how will the function know what values to write to the two pins...?
You've told us that about a dozen times already. And you've been told just about as often
1) that this is a bad idea, for the controller your using 2) how you can do it, if you still think you have to.
So what on earth do you think you'll achieve by posting the same question yet another time?
Did it still not occur to you that just because you want something doesn't mean you'll get it?
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
Note the <<= shifts and assigns - so left side better be assignable.