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

memory location c8051f381

hii
Does it change the memory location following two forms of writing?
float EffectiveTime=0;
float EffectiveTime=0;
Thanks

Parents Reply Children
  • When I select the first option I have strange effects
    Perhaps the memory overflow

    1)

    #include "compiler_defs.h"
    #include "C8051F380_defs.h"                // SFR declarations
    #include <stdio.h>
    #include <string.h>
    #include <math.h>
    #include <float.h>
    
    #include "LCD_controll_M_40.c"
    #include "Memory_mangment_M_40.c"
    #include "rtc_controll_M_40.c"
    .
    .
    .
    float EffectiveTime=0;
    
    .
    .
    .
    void main (void)
    {
    .
    .
    .
    .
    
    
    
    
    }
    

    2)

    #include "compiler_defs.h"
    #include "C8051F380_defs.h"                // SFR declarations
    #include <stdio.h>
    #include <string.h>
    #include <math.h>
    #include <float.h>
    
    #include "LCD_controll_M_40.c"
    #include "Memory_mangment_M_40.c"
    #include "rtc_controll_M_40.c"
    .
    .
    .
    float EffectiveTime;
    
    .
    .
    .
    void main (void)
    {EffectiveTime=0;
    ..
    }
    

  • so, your first post should have been:

    Does it change the memory location following two forms of writing? float EffectiveTime=0; float EffectiveTime;

    and the answer is: probably

    it MAY be that the compiler bunches initialized variables separate from non-initialized.

    anyhow, why do you care?

  • You're right I did not frame the question correctly
    I would like to understand how memory works

  • I would like to understand how memory works
    reading your question as is the answer is "you put data there to read it later"
    I'm sure that is not your problem, but for "how memory works" I have no other answer