Q:

How to access the fixed memory location in embedded C?

0

How to access the fixed memory location in embedded C?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

Let us see an example code to understand this concept. This question is one of the best questions of the embedded C interview question.

Suppose in an application, you need to access a fixed memory address. So you need to follow the below steps, these are high-level steps.

//Memory address, you want to access
#define RW_FLAG 0x1FFF7800
//Pointer to access the Memory address
volatile uint32_t *flagAddress = NULL;
//variable to stored the read value
uint32_t readData = 0;
//Assign addres to the pointer
flagAddress = (volatile uint32_t *)RW_FLAG;
//Read value from memory
* flagAddress = 12; // Write
//Write value to the memory
readData = * flagAddress;

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Embedded C interview questions and answers (2022)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Difference between RISC and CISC processor?... >>
<< Infinite loops often arise in embedded systems. Ho...