akshay123:
Problem in making state machine call and pointing to the proper address in eeprom?
1. Please, add some lines of codes (whatever comes in your mind) with the foundation sketch of Post#4 in order to read data from all these EEPROM locations: 0x0010 - 0x0023 and store them in this array: byte readArray[20];.
Hints: declare the array in the global space and then execute this instruction in the setup() space: EEROM.get(0x0010, readArray);. Print a data byte from a known location of the readArray[] and check that the data byte is correct.
2. Once the job of Step-1 is done, we will address your next question.
3. In case you have serious problem in the coding, you may consult the following sketch:
#include<EEPROM.h>
byte dataArray[20] =
{
0x14, 0x05, 0x01, 0x01, 0x28, 0x0A, 0x02, 0x02, 0x3C, 0x0F, 0x03, 0x03,
0x50, 0x14, 0x04, 0x04, 0x64, 0x19, 0x05, 0x05
}; //0x0010, 0x0011, ..., 0x0023
byte readArray[20];
void setup()
{
Serial.begin(9600);
DDRB = 0xFF; //IO lines are outputs
DDRC = 0xFF; //IO lines are outputs
EEPROM.put(0x0010, dataArray); //data of the whole array is written
byte x = EEPROM.read(0x0017);
Serial.println(x, HEX); //shows 2 (02) data is well written
//---reading all data bytes form EEPROM and save in array----
EEPROM.get(0x0010, readArray);
Serial.println(readArray[0], HEX); //data validity check
//--extract port data and time delay information from 0x0010-0x0013--
int mapDelay = map((readArray[1]<<8|readArray[0]), 0, 65536, 0, 5000);
PORTC = readArray[2]; //
bitWrite(PORTB, 6, bitRead(readArray[2], 6));
bitWrite(PORTB, 7, bitRead(readArray[2], 7));
PORTB = readArray[3];
delay(mapDelay); //wait for 100ms
//----------------------------------
}
void loop()
{
}