I was taught if the variable might be changed by OS,hardware, or interrupt routine asynchronous it must be declared as "volatile" !
But reviewing current code base I found no "volatile" variables for H/W but it works well...
My question is: besides using "volatile" variable is there any way to access peripheral device mapped to XDATA ?
"The 'lucky' part can quickly change..."
Absolutely!
So, in fact, it is not good luck that it "worked"; it is rather bad luck - because it is liable to "suddenly" stop working for no "apparent" reason!
Maybe the only reason it "works" is because he hasn't (yet) enabled any optimisations...?
Hi,
Thank for your kink reply. I still not understand how to configure the setting. Please can you guide me?
Thank you.
What setting?
You say that it currently "works" - so the basic memory access must be OK.
Your only risk is that optimisations might cause the compiler to "cache" the value when it shouldn't - and the one and only way to prevent that is to use the volatile qualifier.
What other "setting(s)" are you thinking of?
Hi, all...
My [Code Optimization] settins are: - Level 9 - Favor Size
Thus Optimization Level 9(the highest one) was applied.
F.Y.I
For Author n00b help -> I think your post is NOT for this topic, right ?
For other Authors -> I tend to believe what happened to me is bad luck and afterwards I will use volative and _at_ to access memory-mapped devices...
liaoo