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

Reading a memory location into a C varaible

Hi,

I need to read a memory location (SRAM)and load the value into a variable of type integer in my 'C' code.

How do I achieve the above mentioned problem in C?

Do I need to do some kind of translations to be done when I read the value so that it would be read as proper integer?

Regards,
Jinen Dedhia

Parents
  • "How do I achieve the above mentioned problem in C?"

    #define SOME_ADDRESS 0x1234
    
    int i = *(int*)SOME_ADDRESS;
    "Do I need to do some kind of translations to be done when I read the value so that it would be read as proper integer?"

    That depends on the how the value is stored in memory versus your platform's requirements.

Reply
  • "How do I achieve the above mentioned problem in C?"

    #define SOME_ADDRESS 0x1234
    
    int i = *(int*)SOME_ADDRESS;
    "Do I need to do some kind of translations to be done when I read the value so that it would be read as proper integer?"

    That depends on the how the value is stored in memory versus your platform's requirements.

Children