Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/20/08 10:14
Read: times


 
#154954 - Map the variables in correct memory area
Responding to: ???'s previous message
Dear Raj,

Yours was a problem where your variable was manipulating stack content. It is good that it got solved, but this may not be so easy everytime.

Hence it is necessary to map the variable into correct memoty area. Where to map it depends on number of criterias like size(no of bytes occupied), how oftenly it is used, nature of data etc...

In your case it seems to be constant data & can be added to code area. On reading the initialisation it seems that "ALARM1", "ALARM2", ... are labels / constant strings, while XXXXxxxx are the values. Is it?

If that is the case then you can declare them as different addresses in code area like

code int ALARM1 = XXXX;
code int ALARM2 = xxxx;


if such is done, there is no need to break the long string to extract the values.

Another way of using the values without occupying any memory space is to #define them

#define ALARM1 XXXX
#define ALARM2 xxxx


If you use it this way the execution is even faster as compiler will treat this as data and it donot require to read it from memory.


In both above cases (code int ALARM1 or #define ALARM1), you can straightforward use statement like

if(value < ALARM1)

Regards,
Mahesh


List of 16 messages in thread
TopicAuthorDate
Array size limitation for Keil ?            01/01/70 00:00      
   if you breakpoint            01/01/70 00:00      
      Time to check the assembler output....            01/01/70 00:00      
      RE: you can not break on the declaration of a vari            01/01/70 00:00      
         you can not break on the declaration of a variable            01/01/70 00:00      
   You seem to be declaring constant            01/01/70 00:00      
      It is fully possible....            01/01/70 00:00      
         idata as stack            01/01/70 00:00      
   Keil compiler limits            01/01/70 00:00      
      I agree - its not a limit            01/01/70 00:00      
         Well maybe....            01/01/70 00:00      
            64 or 128            01/01/70 00:00      
   It was the stack            01/01/70 00:00      
      The compiler cannot really guess ..            01/01/70 00:00      
      Glad you have it working            01/01/70 00:00      
   Map the variables in correct memory area            01/01/70 00:00      

Back to Subject List