This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Global Variable Initialization

Hello,

I have variables initialized at the global level in my .c file but they are never being initialized. When I watch in d-scope and INIT.a51 is executing:

?C_START:
MOV DPTR,#?C_INITSEG
LOOP:
WATCHDOG
CLR A
MOV R6,#1
MOVC A,@A+DPTR
JZ INITEND <------Here!!!!!!!!!!
INC DPTR
MOV R7,A
ANL A,#3FH
JNB ACC.5,NOBIG

the code jumps right to INITEND because the MOVC instruction puts zero into the accumulator, even though I've initalized global variables with values. Anyone see the problem?

Thanks,

Bob

Parents
  • I ran into a problem where I had my c relocatable as the first parameter , and startup.obj as the second. When it was in this configuration, the reset vector was not listed as the first instruction in the .hex file. Putting startup .obj as the first parameter corrected this.

    Just my experience, hope it helps.

Reply
  • I ran into a problem where I had my c relocatable as the first parameter , and startup.obj as the second. When it was in this configuration, the reset vector was not listed as the first instruction in the .hex file. Putting startup .obj as the first parameter corrected this.

    Just my experience, hope it helps.

Children
No data