Hello. I copied "LCD_4bit.c" and "LCD.h" files from Keil examples folder to my project folder and add it to my project. Then I changed Pins definition in "LCD_4bit.c" according to my project board LCD pins(LPC 2378). (I don't think that The problem is here.) Then I could successfully Build it, but when I download it to my project board,there is no signs that LCD works. However when I compile "LCD_4bit.c" in IAR environment ,the produced "hex file" works well on my project board. Thanks for your help.
Looking at the HLL source does not allow you to make any prediction at all about its timing - because you cannot make any prediction about what code the compiler will generate.
"looking at a HLL delay loop doesn't allow you to predict its timing up to the exact click"
It does not not allow you to predict the timing at all.
"looking at an assembler delay loop doesn't allow you to predict its timing"
That is not necessarily true.
In summary:
In a HLL, you cannot predict the timing at all; In assembler, you might not be able to predict the timing.
Therefore, the original recommendation not to use a HLL stands.
The alternative should be qualified as, "if it can be done at all, it must be done in assembler"
"In a HLL, you cannot predict the timing at all;"
I am going to make the following prediction about the timing of any HLL delay, and I can guaranttee you that it is 100% accurate under any circumstance:
any delay, being it HLL or assembler, software or hardware, will generate a delay whose duration is between 0 and infinity
prove me wrong, please.
and totally worthless.
"totally worthless."
you insisted that no one could predict the timing and I just showed you how wrong that statement was.
but more seriously, here is a point that you have been unable to comprehend consistently: you can always predict the timing of anything. except that the tighter your tolerance, the more likely you are going to be wrong.
in the case of an assembler, baring any of the factors we discussed, you could more accurately predict the timing than you could with a HLL delay.
that statement means two things:
1) you can predict the duration of a hll delay - you may not be as accurately do so, but you can, nonetheless.
2) you can NOT predict the duration of an assembly delay with absolute accuracy. aka it is not a drop-in-and-forget-about-it scenario that you made it out to be.
think about that.
"you insisted that no one could predict the timing and I just showed you how wrong that statement was."
Not at all.
I can't predict any current just by saying that current is measured in Ampere. You have no more predicted any delay. You are just busy running around in larger and larger circles.
0 is no delay, so it isn't a delay. Hence, we can't bracket at [0..x] but must bracket at (0..x]
If 0 isn't a delay, then a delay that gets removed doesn't result in any accuracy error since you would get a division by zero - any delay guess you make would be infinitely wrong if the delay code ends up totally removed.
The big difference with the assembler in relation to the HLL implementation, is that the assembler delay always produces a delay. So it does allow us to talk about accuracy.
"think about that"
What most people are thinking is probably that this thread has ended up as random, irrelevant, noise. All because you constantly lose your focus on the important things because you don't have anything to do but to try to argue everything to death.
rubbish deleted.
"If 0 isn't a delay, then a delay that gets removed"
so your reason against using HLL delay has been moved from its (perceived) lack of "visibility" (which assembler suffers as well) now to its risk of being optimized out by a HLL compiler?
if that's the case, the solution is so rudimentarily simple that I am embarrassed that you don't know it.
No - I can still see all of your posts!
"[...] so your reason against using HLL delay has been moved from [...]"
Moved from?
It was my first post in this thread.
By the way - I read the "rubbish deleted" part and got happy. Then I realised this forum doesn't have any buttons allowing posters to remove or correct previous, bad, posts.
"now to its risk of being optimized out"
Now? This has been covered already in this tread, and multiple other threads.
"that I am embarrassed that you don't know it."
Suggestions how to make HLL loops having a side effect that blocks them from being removed has been covered a number of times on this site. And in posts by me in threads you have, yourself, been active in.
Stop random ad hominem mumbo jumbo, since that can never make you victorious in any debate. Besides, you are only starting the type of debates that can only have a large number of losers. The important thing is: "focus on the ball".
"Then I realised this forum doesn't have any buttons allowing posters to remove or correct previous, bad, posts."
lucky for you.
if it did, all your posts would have vanished.
"ad hominem"
do you even know what it means? didn't sound like that.
"do you even know what it means? didn't sound like that."
So please expand on your reasoning for writing the following, with is obviously intended to focus on me instead of on actual arguments of this thread:
"if that's the case, the solution is so rudimentarily simple that I am embarrassed that you don't know it."
When busy elaborating - maybe you could explain the "all" in: And maybe "if it did, all your posts would have vanished.".
But then again - you don't need to explain. You actually did. I did intend a 'delete' button allowing posters to erase own posts. But you would be more happy with a 'delete' button allowing you to delete arbitrary posts by any poster. Then you could end up with a thread with nothing but your own posts. Oops. Me bad. Should say "end up with a forum".
Your posts regularly contains sentences totally without substance, and totally outside any debate. And when someone points at such a sentence, you respond with more sentences without real substance.
Your last response was in output-only mode. No answers to my questions in my previous post. How you consider me to have suddenly changed my mind. Or how I could suddenly have forgotten how to make HLL loops force side effects.
You can't both be a respected forum visitor and a troll. These two functions are mutually exclusive. Trolling while trying to sound like an expert just gets the regulars, who try to help peope, to shake their heads while the new visitors with real problems have to jump the ship because they get their threads destroyed.
"Your posts regularly contains sentences totally without substance ..."
And without capitalization.
Inability to follow the rules of capitalization was one of the reasons for getting canned -- couldn't write acceptable documents.
... is a big problem in a case-sensitive language.