We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
In one of my project I am talking with MX909 Driver IC with C51 ucontroller. To initialize MX909 if I write module in Assembly language it's working fine. Once I replaced with C same module it's not working.
The only difference I can make for both assembly and C languages is NOP and _nop_() instruction. Is both instructions will take same number of machine cycles?
Thanks, Suresh Kumar Kavula
My guess is that you suffer from some fallacy that e.g. a for loop is the same as a djnz loop and nothing could be farther from the truth.
Jack,
The authoritative masquerade very clearly exposed!
"The authoritative masquerade very clearly exposed!"
Not really.
All it has shown is that, in one particular case, the for loop just happened to turn out as a simple DJNZ loop.
In general, you can't assume that.
eg, in the example shown, the oprimiser has happened to assign the loop counter to R7 - unrelated changes in the source code could change that, which may or may not affect the loop timing!
One more time: There is absolutely no guarantee whatsoever etc, etc,...
Does "Jack" now need an audience to give some applause whenever he (doesn't) find an error in Erik's arguments ?
int main(void) { unsigned char loop; for(loop = 128; loop != 0; loop--) { } while(1); return(0); }
Here's an easy question:
Assume nothing about the compiler, except that it is actually working correctly. The for loop above will result in (more than one answer may be correct):
a) a DJNZ loop b) another type of loop c) no loop at all
True. But it's a long walk over very thin ice from that to Erik's "nothing could be further from the truth". It's this kind of excessive generalization and his reaction when they're pointed out to him, that so irritates people about Erik.
What is the prize for people who get the right answer ?
Here's hoping it's not a trick question!
Is this supposed to be funny ?
Not funny - More sad ... That a potentially useful forum can have so many members that post useful responses muddied by very few who post in a manner that just triggers such negative reactions.
The warm, fuzzy feeling of knowing that they won't fall into the trap of expecting a delay loop in C to give an exact delay.
Not at all. On the contrary, there's even a hint pointing in the right direction.