My Flash Write Library is working fine when iam using Level 8 Optimization in Keil Compilor but when i use constant folding(Level 0) it was not working kindly give me a solution.
Thanks in Advance
Simple solution; don't use constant folding (Level 0) ;)
Or, narrow down the problem by reducing the code to an absolute minimum while still exhibiting the fault and look at the code produced to determine whether it is a compiler problem or a coding problem.
"...working fine when iam using Level 8 Optimization in Keil Compiler but when i use constant folding (Level 0) it was not"
Remember that each higher optimisation level includes all the lower-level optimisations: http://www.keil.com/support/man/docs/c51/c51_optimize.htm
Therefore, Level-8 includes constant folding.
You need to reduce the optimisation a step at a time to determine where it actually stops working - and then examine the differences between the generated code at that point.
Could you be using software delay loops, and these end up just being too slow at the lower optimisation? (this is why you should never write software timing loops in a high-level language)
"you should never write software timing loops in a high-level language"
That is, not if you want any sort of guarantee of the timing- see: www.8052.com/.../read.phtml