desgin
Full Member level 1
Hello All,
I am writing code for EEPROM Write and EEPROM read but code is getting so long.
So, I need your help for Code Optimization.
Here, I have to write 5000 bytes in EEPROM one by one.
Please help me
its urgent!
Thanks in advance!
I am writing code for EEPROM Write and EEPROM read but code is getting so long.
So, I need your help for Code Optimization.
Here, I have to write 5000 bytes in EEPROM one by one.
- Some Variables/Parameters are of 4 bytes and some are 2 bytes.
- Only Variables names & location number of EEPROM is getting changed
Code:
uint32_t write_var;
write_var = (uint32_t)(Sensor1_value); // 4 Bytes data
EEPROM_Write_data[0] = (write_var>> 24) & (0x000000FF);
EEPROM_Write_data[1] = (write_var>> 16) & (0x000000FF);
EEPROM_Write_data[2] = (write_var>> 8) & (0x000000FF);
EEPROM_Write_data[3] = (write_var) & (0x000000FF);
write_var = (uint32_t)(Sensor2_value); // 4 Bytes data
EEPROM_Write_data[4] = (write_var>> 24) & (0x000000FF);
EEPROM_Write_data[5] = (write_var>> 16) & (0x000000FF);
EEPROM_Write_data[6] = (write_var>> 8) & (0x000000FF);
EEPROM_Write_data[7] = (write_var) & (0x000000FF);
write_var = (uint32_t)(Sensor3_value); // 2 Bytes data
EEPROM_Write_data[8] = (uint8_t)((write_var>> 8) & (0x00FF));
EEPROM_Write_data[9] = (uint8_t)((write_var) & (0x00FF));
.
.
.
.
.
write_var = (uint32_t)(Sensor1000_value); // 4 Bytes data
EEPROM_Write_data[4997] = (write_var>> 24) & (0x000000FF);
EEPROM_Write_data[4998] = (write_var>> 16) & (0x000000FF);
EEPROM_Write_data[4999] = (write_var>> 8) & (0x000000FF);
EEPROM_Write_data[5000] = (write_var) & (0x000000FF);
its urgent!
Thanks in advance!
Last edited by a moderator: