Hi, I am developing a firmware for EZUSB FX based board. I am facing a small problem. I am not able to initialize a Global variable in my firmware. Even though I assign the global variable with 0 initial value, But the variable does not take that value. I am using SMALL memory model for my development. my declerations looks like this :- BYTE GlobalCount = 0; and in my sof() I am using this variable and updating it and reusing it again in next sof(). Please advise .. Rahul Gupta
Hi, 1) Memory model is small 2) My initialization is BYTE GlobalCount = 0; So, DO I have to clear XDATA in my STARTUP code.(I am not using xdata here) I am a beginner on 8051, So I might be making very basic mistake. Please Advise ... Thanks Rahul
Since GlobalCount is declared as follows:
BYTE GlobalCount = 0;
it is the last file indeed ..!! but still ..no respite !! Another piece of information I want to add here is the function is a interrupt routine called sof().. and i want use the global variable across the Sof's (like for counting number of interrupts .. etc ) Also, I have DSCR.A51, Init.A51 and STARTUP.A51 included in my projects in that order. TIA Rahul
Look, whether the STARUP.A51 is the last File for the Compile and Link Process (in uV2 the last in the Tree).
yeah i am including them !! But still global variable is not initialized I am just including these files in my project. Is there anything else which needs to be done here ... TIA Rahul
Are you including in your project STARTUP.A51 (to initialize memory to zero) and INIT.A51 (to copy static initialized data from ROM to RAM)?
View all questions in Keil forum