0

I have few question to the arduino memory.

  1. Does it make sense to move global Variables, a single int, with PROGMEM in the Flash Memory or does that the Compiler for me? Or should I declare the global variable "#define" instead "static const int xy =..."

  2. A static Variable in the loop function Example:

    void loop() { static unsigned short Array [] = {Global_Variable_1, Global_Variable_2,...} }

Where is that Variable "Array" stored? Is it right that it is stored only in the SRAM?

1 Answer 1

0

For 1) For an int, using PROGMEM is not need. Compiler won't do it for you. #define is not a global, #define can't be edited, it's just a macros handle by precompiler, so a #define don't use any memory

for 2) Array is a global so it is stored in the data segment of the prog, it will be loaded in SRAM to be used at run time if you use PROGMEM it will be stored into flash memory

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.