Hi, I am using c51 keil compiler with cygnal chip c8051C020. I find problem in initilise static variable. exp. main() { static unsigned char i =0 ; i++; } when i write this type of code & simulate it ,i find that i is not initilise to 0. Note:this is just example code & not the actual program i work. If any specify me the reasion it will help me lot. Regards, Pandurang S.
still i have facing the same problem (i.e. static variable not initilise to proper value). if you are using internal XRAM you will not, unless you put all memory related initialize at the very beginning of (a renamed copy of) startup.a51. Erik
hi, I have add the INIT.A51 & STARTUP.A51 files.But still i have facing the same problem (i.e. static variable not initilise to proper value). Regards, Pandurang S.
"The code that i have put in the forum is just an examle" Please don't do that, it is a waste of our time. Copy and paste the code you are using, do not retype it as you will make mistakes.
never include the start.A51 & init.A51 And in any way the variable should initilise to 0 even if it not make any sense. what does not make sense is that you "never include" the code that initializes the variables and the complain that they are not initialized. Erik
hi, The code that i have put in the forum is just an examle,i am using the static variable not in main routine but in other function which i calling in main routine. And in any way the variable should initilise to 0 even if it not make any sense. Regards, Pandurang S.
static unsigned char i =0 ;
unsigned char i =0 ;
hi, Thanks for reply. At present i worked with few project and never include the start.A51 & init.A51 file in my project, but never face this type of problem, which i am facing presently. What is reason for it. Regards, Pandurang S.
Read the Manual about INIT.A51, what it does, and why you may need it.
View all questions in Keil forum