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
yea. but you said you cant do it. do you want a copy of my thesis for reference?
Well that thesis should - if it cared about this kind of embedded processors - have noted the big issues with wear and speed for rewriting flash data. Self-modifying code is only relevant when the processor supports running of code in RAM.
look mate. you dont know what my thesis says cause you havent seen it! i just said you can do it here. not my fault that some random guy jumps in and says you cant when you can. sure ram is better but other way works too.
do you want a copy of my thesis for reference? naah, I wrote self modifying code before you were born.
In the olden days, with minicomputers and cycle times of multiple microserconds, self modifying code was, occasionally, a necessity for throughput reasons is parameter based processing. In those days we, sometimes, had to write code that was horrible, but worked faster than clean code.
I REALLY wonder what legit purpose self modifying code has today with nanosecond cycle times.
Erik
Well that thesis should - if it cared about this kind of embedded processors - have noted the big issues with wear and speed for rewriting flash data who cares, the issue is to get a thesis written, if it has a practical application (can be used in actual projects) is irrelevant.
naah, I wrote self modifying code before you were born.
you are a right fool matey. how old are you? im 63 and did my thesis as a mature student 5 years ago.
that I did not consider the possibility of a "mature student" allowed you to circumvent everything else (flash wear, time to erase/write flash, irrelevance, ....)
The important thing here is that self-modifying code in flash is really irrelevant for a case where a port pin needs to be toggled. Even doing a pin toggle once/day multiplied with two different pins, would result in 700 flash erase cycles/year.
you are very negative. use some imagination. maybe you should read my thesis. you could learn a lot.
"I REALLY wonder what legit purpose self modifying code has today with nanosecond cycle times."
Self-modifying code can still be relevant today. You can squeeze extra speed out of an expensive graphics filter after you know what matrix weights that are zero. Whenever you have some form of vector processing where a huge amount of data needs to be processed, based on a user-editable configuration, there can be great opportunities for speedup. Of course, it requires that the platform can get both write and execute access to the memory region used.
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
Note the <<= shifts and assigns - so left side better be assignable.