Hi, I have experienced a strange problem. When a particular variable is initailised to a particular value, sometimes it never works. But if a debug statement is put before the initialisation statement, it starts to work. This problem need not be only during initiasation but this can happen anywhere( i.e... before calling a function or initialising the structure variables etc..). Strange thing is that after removing the debug statement and recompiling, The code works properly. Sometimes it need not be only debug statement, a "delay" or "wait" can also work wonders. We are using C51 compiler - ver 3.20. Pls let me know if there is any solution for this. Thanks in advance. Guruprasad K
When a particular variable .. , a "delay" or "wait" can also work wonders. sounds a lot like either a timping problem or a variable accessed botd from interrupt and main. Please elaborate. Erik
When faced with these sort of problems, my first reaction is to suspect the optimiser. Try: - Looking at the object code generated, does it look right. - Turning down the level of optimisation and see if the code starts to work.
Turning down the level of optimisation and see if the code starts to work If the problem is timing or interrupt interaction, this might hide the problem, rather than fix it. Erik