0
0
Embedded Cprogramming~10 mins

Memory layout on a microcontroller (Flash, SRAM, EEPROM) in Embedded C - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a variable stored in Flash memory.

Embedded C
const char message[] [1] = "Hello";
Drag options to blanks, or click blank then click option'
APROGMEM
Bvolatile
Cstatic
Dregister
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'volatile' instead of 'PROGMEM' for Flash storage.
2fill in blank
medium

Complete the code to declare a variable stored in SRAM.

Embedded C
[1] int counter = 0;
Drag options to blanks, or click blank then click option'
Aregister
Bvolatile
Cconst
Dstatic
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'register' which stores variable in CPU register, not SRAM.
3fill in blank
hard

Fix the error in the code to correctly declare a variable in EEPROM.

Embedded C
uint8_t [1] eeprom_var;
Drag options to blanks, or click blank then click option'
APROGMEM
BEEMEM
Cvolatile
Dstatic
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'PROGMEM' which stores data in Flash, not EEPROM.
4fill in blank
hard

Fill both blanks to create a dictionary of variable types and their memory sections.

Embedded C
const char* memory_map[] = {"Flash", [1], "SRAM", [2];
Drag options to blanks, or click blank then click option'
A"PROGMEM"
B"volatile"
C"static"
D"EEMEM"
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing EEPROM keyword with SRAM.
5fill in blank
hard

Fill all three blanks to complete the code that reads a byte from EEPROM and stores it in SRAM.

Embedded C
uint8_t [2] EEMEM;
uint8_t [1] = eeprom_read_byte((uint8_t*)[3]);
Drag options to blanks, or click blank then click option'
Adata_sram
Bdata_eeprom
C&data_eeprom
Ddata_flash
Attempts:
3 left
💡 Hint
Common Mistakes
Passing variable instead of address to eeprom_read_byte.