This is the third blog update after I started to build the infrared remote control code learner (here are links to the previous posts: 1, 2, 3 ) .  I thought it would go faster, but it turned out to be a quite difficult task, which I am still working on.  So far, as I showed in my previous blog, I built a circuit and algorithm that captures the infrared signal from a remote control, decodes it, measures the infrared carrier frequency (which can have various values typically between 30kHz and 60kHz), and encodes it in a format that can be further stored in the EEPROM memory block of the PsoC5LP chip. In this update I will show how I store the infrared remote control codes into the EEPROM array inside the Cypress PSoC5LP  chip and how I read it back.  Next step would be to reconstruct the infrared signal and send it to an IR LED.  When done with this task I will implement the code learner into my brainwaves appliance controller project so users can “teach” the brainwaves appliance controller specific codes needed to control their TVs, cable or satellite receivers, and other electronic devices that use infrared remote control.

 

So let’s take a look on how I have approached the code writing into EEPROM memory block task.  First, I need to fit 8 infrared remote control codes into the 2k EEPROM memory inside the PSoC5LP.  Each remote control code is sampled and then encoded in a compressed format that fits in an array of 224 locations.  

For each infrared remote control code I need to store an array of size 224 uint8 values and additionally the infrared carrier frequency and unit interval.   In the table below I am showing how I mapped the 2k EEPROM block inside PSoC5LP to store these 8 infrared remote control codes.  There are 128 rows and each row has 16 locations of 8 bits each.

 

EEPROM Memory Mapping

 

Row numbermem_bas_index
00code_0_IR_remotecode0_IR_carrier_freg_and_unit_interval
116code0_IR_carrier_on array [0-15]
232code0_IR_carrier_on array [16-31]
348code0_IR_carrier_on array [32-47]
464code0_IR_carrier_on array [48-63]
580code0_IR_carrier_on array [64-79]
696code0_IR_carrier_on array [80-95]
7112code0_IR_carrier_on array [96-111]
8128code0_IR_carrier_off array [0-15]
9144code0_IR_carrier_off array [16-31]
10160code0_IR_carrier_off array [32-47]
11176code0_IR_carrier_off array [48-63]
12192code0_IR_carrier_off array [64-79]
13208code0_IR_carrier_off array [80-95]
14224code0_IR_carrier_off array [96-111]
15240
16256code_1_IR_remotecode1_IR_carrier_freg_and_unit_interval
17272code1_IR_carrier_on array [0-15]
18288code1_IR_carrier_on array [16-31]
19304code1_IR_carrier_on array [32-47]
20320code1_IR_carrier_on array [48-63]
21336code1_IR_carrier_on array [64-79]
22352code1_IR_carrier_on array [80-95]
23368code1_IR_carrier_on array [96-111]
24384code1_IR_carrier_off array [0-15]
25400code1_IR_carrier_off array [16-31]
26416code1_IR_carrier_off array [32-47]
27432code1_IR_carrier_off array [48-63]
28448code1_IR_carrier_off array [64-79]
29464code1_IR_carrier_off array [80-95]
30480code1_IR_carrier_off array [96-111]
31496
32512code_2_IR_remotecode2_IR_carrier_freg_and_unit_interval
33528code2_IR_carrier_on array [0-15]
34544code2_IR_carrier_on array [16-31]
35560code2_IR_carrier_on array [32-47]
36576code2_IR_carrier_on array [48-63]
37592code2_IR_carrier_on array [64-79]
38608code2_IR_carrier_on array [80-95]
39624code2_IR_carrier_on array [96-111]
40640code2_IR_carrier_off array [0-15]
41656code2_IR_carrier_off array [16-31]
42672code2_IR_carrier_off array [32-47]
43688code2_IR_carrier_off array [48-63]
44704code2_IR_carrier_off array [64-79]
45720code2_IR_carrier_off array [80-95]
46736code2_IR_carrier_off array [96-111]
47752
48768code_3_IR_remotecode3_IR_carrier_freg_and_unit_interval
49784code3_IR_carrier_on array [0-15]
50800code3_IR_carrier_on array [16-31]
51816code3_IR_carrier_on array [32-47]
52832code3_IR_carrier_on array [48-63]
53848code3_IR_carrier_on array [64-79]
54864code3_IR_carrier_on array [80-95]
55880code3_IR_carrier_on array [96-111]
56896code3_IR_carrier_off array [0-15]
57912code3_IR_carrier_off array [16-31]
58928code3_IR_carrier_off array [32-47]
59944code3_IR_carrier_off array [48-63]
60960code3_IR_carrier_off array [64-79]
61976code3_IR_carrier_off array [80-95]
62992code3_IR_carrier_off array [96-111]
631008
641024code_4_IR_remotecode4_IR_carrier_freg_and_unit_interval
651040code4_IR_carrier_on array [0-15]
661056code4_IR_carrier_on array [16-31]
671072code4_IR_carrier_on array [32-47]
681088code4_IR_carrier_on array [48-63]
691104code4_IR_carrier_on array [64-79]
701120code4_IR_carrier_on array [80-95]
711136code4_IR_carrier_on array [96-111]
721152code4_IR_carrier_off array [0-15]
731168code4_IR_carrier_off array [16-31]
741184code4_IR_carrier_off array [32-47]
751200code4_IR_carrier_off array [48-63]
761216code4_IR_carrier_off array [64-79]
771232code4_IR_carrier_off array [80-95]
781248code4_IR_carrier_off array [96-111]
791264
801280code_5_IR_remotecode5_IR_carrier_freg_and_unit_interval
811296code5_IR_carrier_on array [0-15]
821312code5_IR_carrier_on array [16-31]
831328code5_IR_carrier_on array [32-47]
841344code5_IR_carrier_on array [48-63]
851360code5_IR_carrier_on array [64-79]
861376code5_IR_carrier_on array [80-95]
871392code5_IR_carrier_on array [96-111]
881408code5_IR_carrier_off array [0-15]
891424code5_IR_carrier_off array [16-31]
901440code5_IR_carrier_off array [32-47]
911456code5_IR_carrier_off array [48-63]
921472code5_IR_carrier_off array [64-79]
931488code5_IR_carrier_off array [80-95]
941504code5_IR_carrier_off array [96-111]
951520
961536code_6_IR_remotecode6_IR_carrier_freg_and_unit_interval
971552code6_IR_carrier_on array [0-15]
981568code6_IR_carrier_on array [16-31]
991584code6_IR_carrier_on array [32-47]
1001600code6_IR_carrier_on array [48-63]
1011616code6_IR_carrier_on array [64-79]
1021632code6_IR_carrier_on array [80-95]
1031648code6_IR_carrier_on array [96-111]
1041664code6_IR_carrier_off array [0-15]
1051680code6_IR_carrier_off array [16-31]
1061696code6_IR_carrier_off array [32-47]
1071712code6_IR_carrier_off array [48-63]
1081728code6_IR_carrier_off array [64-79]
1091744code6_IR_carrier_off array [80-95]
1101760code6_IR_carrier_off array [96-111]
1111776
1121792code_7_IR_remotecode7_IR_carrier_freg_and_unit_interval
1131808code7_IR_carrier_on array [0-15]
1141824code7_IR_carrier_on array [16-31]
1151840code7_IR_carrier_on array [32-47]
1161856code7_IR_carrier_on array [48-63]
1171872code7_IR_carrier_on array [64-79]
1181888code7_IR_carrier_on array [80-95]
1191904code7_IR_carrier_on array [96-111]
1201920code7_IR_carrier_off array [0-15]
1211936code7_IR_carrier_off array [16-31]
1221952code7_IR_carrier_off array [32-47]
1231968code7_IR_carrier_off array [48-63]
1241984code7_IR_carrier_off array [64-79]
1252000code7_IR_carrier_off array [80-95]
1262016code7_IR_carrier_off array [96-111]
1272032

 

After defining this memory map I started to write a function that would take the measured and encoded data and store it in one of the 8 blocks that I defined in the memory map.  Here is the function that writes data into the EEPROM.  The writing is done row by row, so this function had to rearrange the input data in row format and then write each row in the corresponding memory block.

 

Function to write array into memory:

 

 

void storedata_in_eeprom (uint8 aval[224], uint8 freqcarrier, uint16 unit, uint16 unittrim, uint8 locationnumber)

{

/*EEPROM_Start();*/

/*cystatus eraseStatus;*/

cystatus writeStatus;

uint8 eepromlocation = locationnumber;

uint8 freqeeprom = freqcarrier;

uint8 unit_lower = (unit & 0xF);

uint8 unit_upper = (unit >> 8);

uint8 unittrim_lower = (unittrim & 0xF);

uint8 unittrim_upper = (unittrim >> 8);

uint8 row1_data[SIZEOF_EEPROM_ROW] = {freqeeprom, unit_lower, unit_upper, unittrim_lower, unittrim_upper, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u};

uint8 row2_data[SIZEOF_EEPROM_ROW] = {aval[0], aval[1], aval[2], aval[3], aval[4], aval[5], aval[6], aval[7], aval[8], aval[9], aval[10], aval[11], aval[12], aval[13], aval[14], aval[15]};

uint8 row3_data[SIZEOF_EEPROM_ROW] = {aval[16], aval[17], aval[18], aval[19], aval[20], aval[21], aval[22], aval[23], aval[24], aval[25], aval[26], aval[27], aval[28], aval[29], aval[30], aval[31]};

uint8 row4_data[SIZEOF_EEPROM_ROW] = {aval[32], aval[33], aval[34], aval[35], aval[36], aval[37], aval[38], aval[39], aval[40], aval[41], aval[42], aval[43], aval[44], aval[45], aval[46], aval[47]};

uint8 row5_data[SIZEOF_EEPROM_ROW] = {aval[48], aval[49], aval[50], aval[51], aval[52], aval[53], aval[54], aval[55], aval[56], aval[57], aval[58], aval[59], aval[60], aval[61], aval[62], aval[63]};

uint8 row6_data[SIZEOF_EEPROM_ROW] = {aval[64], aval[65], aval[66], aval[67], aval[68], aval[69], aval[70], aval[71], aval[72], aval[73], aval[74], aval[75], aval[76], aval[77], aval[78], aval[79]};

uint8 row7_data[SIZEOF_EEPROM_ROW] = {aval[80], aval[81], aval[82], aval[83], aval[84], aval[85], aval[86], aval[87], aval[88], aval[89], aval[90], aval[91], aval[92], aval[93], aval[94], aval[95]};

uint8 row8_data[SIZEOF_EEPROM_ROW] = {aval[96], aval[97], aval[98], aval[99], aval[100], aval[101], aval[102], aval[103], aval[104], aval[105], aval[106], aval[107], aval[108], aval[109], aval[110], aval[111]};

uint8 row9_data[SIZEOF_EEPROM_ROW] = {aval[112], aval[113], aval[114], aval[115], aval[116], aval[117], aval[118], aval[119], aval[120], aval[121], aval[122], aval[123], aval[124], aval[125], aval[126], aval[127]};

uint8 row10_data[SIZEOF_EEPROM_ROW] = {aval[128], aval[129], aval[130], aval[131], aval[132], aval[133], aval[134], aval[135], aval[136], aval[137], aval[138], aval[139], aval[140], aval[141], aval[142], aval[143]};

uint8 row11_data[SIZEOF_EEPROM_ROW] = {aval[144], aval[145], aval[146], aval[147], aval[148], aval[149], aval[150], aval[151], aval[152], aval[153], aval[154], aval[155], aval[156], aval[157], aval[158], aval[159]};

uint8 row12_data[SIZEOF_EEPROM_ROW] = {aval[160], aval[161], aval[162], aval[163], aval[164], aval[165], aval[166], aval[167], aval[168], aval[169], aval[170], aval[171], aval[172], aval[173], aval[174], aval[175]};

uint8 row13_data[SIZEOF_EEPROM_ROW] = {aval[176], aval[177], aval[178], aval[179], aval[180], aval[181], aval[182], aval[183], aval[184], aval[185], aval[186], aval[187], aval[188], aval[189], aval[190], aval[191]};

uint8 row14_data[SIZEOF_EEPROM_ROW] = {aval[192], aval[193], aval[194], aval[195], aval[196], aval[197], aval[198], aval[199], aval[200], aval[201], aval[202], aval[203], aval[204], aval[205], aval[206], aval[207]};

uint8 row15_data[SIZEOF_EEPROM_ROW] = {aval[208], aval[209], aval[210], aval[211], aval[212], aval[213], aval[214], aval[215], aval[216], aval[217], aval[218], aval[219], aval[220], aval[221], aval[222], aval[223]};

uint8 rownumber = 0;

 

 

 

 

if(eepromlocation == 0) rownumber = 0u ;

if(eepromlocation == 1) rownumber = 16u ;

if(eepromlocation == 2) rownumber = 32u;

if(eepromlocation == 3) rownumber = 48u;

if(eepromlocation == 4) rownumber = 64u;

if(eepromlocation == 5) rownumber = 80u;

if(eepromlocation == 6) rownumber = 96u;

if(eepromlocation == 7) rownumber = 112u;

 

 

 

 

/* Get the die temp. */

    if(CySetTemp() == CYRET_SUCCESS)

    {

        /* Write TestData1 to EEPROM row 0 */       

        writeStatus = EEPROM_Write(row1_data, rownumber);

        writeStatus = EEPROM_Write(row2_data, rownumber+1u);

        writeStatus = EEPROM_Write(row3_data, rownumber+2u);

        writeStatus = EEPROM_Write(row4_data, rownumber+3u);

        writeStatus = EEPROM_Write(row5_data, rownumber+4u);

        writeStatus = EEPROM_Write(row6_data, rownumber+5u);

        writeStatus = EEPROM_Write(row7_data, rownumber+6u);

        writeStatus = EEPROM_Write(row8_data, rownumber+7u);

        writeStatus = EEPROM_Write(row9_data, rownumber+8u);

        writeStatus = EEPROM_Write(row10_data, rownumber+9u);

        writeStatus = EEPROM_Write(row11_data, rownumber+10u);

        writeStatus = EEPROM_Write(row12_data, rownumber+11u);

        writeStatus = EEPROM_Write(row13_data, rownumber+12u);

        writeStatus = EEPROM_Write(row14_data, rownumber+13u);

        writeStatus = EEPROM_Write(row15_data, rownumber+14u);

   

    }

 

 

/*EEPROM_Stop();*/

}

/* end of function "storedata_in_eeprom" */

 

 

 

 

After writing this function I looked into how to read back the values.  Reading is different than writing; reading can be done at byte level, and I need to read back the infrared carrier frequency, the unit interval used in data encoding (as I showed in the previous blog) and the array of 224 locations that contains the encoded data.  I decided to write three functions, one for each of this type of data.

 

 

Here is the function that reads the carrier frequency.  Basically the function reads the entire first row and then extracts the value from the specific location in the row where the carrier frequency information has been stored.  I could have read only the byte that stores that value, but I decided to read the entire row so that I can reuse this piece of code in the other functions.

 

 

 

 

/* function read frequency from one of the 8 code locations in eeprom */

uint8 read_frequency_from_eeprom (uint8 locationnumber)

{

reg8 * RegPointer;

RegPointer = (reg8 *)CYDEV_EE_BASE;

uint16 Index;

uint8 return_freq;

uint8 eepromlocation = locationnumber;

uint8 row_read[SIZEOF_EEPROM_ROW];

uint16 base_number;

 

 

 

 

 

 

if(eepromlocation == 0) base_number = 0u;/*rownumber = 0u ;*/

if(eepromlocation == 1) base_number = 256u;/*rownumber = 16u ;*/

if(eepromlocation == 2) base_number = 512u;/*rownumber = 32u;*/

if(eepromlocation == 3) base_number = 768u;/*rownumber = 48u;*/

if(eepromlocation == 4) base_number = 1024u;/*rownumber = 64u;*/

if(eepromlocation == 5) base_number = 1280u;/*rownumber = 80u;*/

if(eepromlocation == 6) base_number = 1536u;/*rownumber = 96u;*/

if(eepromlocation == 7) base_number = 1792u;/*rownumber = 112u;*/

 

 

/* Read Data */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number;

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

    }

    return_freq = row_read[0];

    verfreq2 = return_freq;

    return(return_freq);

}

 

 

 

 

 

 

Next, I wrote a function that reads the unit interval.  The unit interval is a uint16 type variable, so it is stored in two locations of the first EEPROM row.  The function reads these two locations as uint8 values and then combines them into a uint16 variable that is then returned.  Here is the function code:

 

 

 

 

/* function read unit interval from one of the 8 code locations in eeprom */

uint16 read_unitinterval_from_eeprom (uint8 locationnumber)

{

reg8 * RegPointer;

RegPointer = (reg8 *)CYDEV_EE_BASE;

uint16 Index;

uint16 return_unit;

uint8 unit_lower;

uint8 unit_upper;

uint8 eepromlocation = locationnumber;

uint8 row_read[SIZEOF_EEPROM_ROW];

uint16 base_number;

 

 

 

 

if(eepromlocation == 0) base_number = 0u;/*rownumber = 0u ;*/

if(eepromlocation == 1) base_number = 256u;/*rownumber = 16u ;*/

if(eepromlocation == 2) base_number = 512u;/*rownumber = 32u;*/

if(eepromlocation == 3) base_number = 768u;/*rownumber = 48u;*/

if(eepromlocation == 4) base_number = 1024u;/*rownumber = 64u;*/

if(eepromlocation == 5) base_number = 1280u;/*rownumber = 80u;*/

if(eepromlocation == 6) base_number = 1536u;/*rownumber = 96u;*/

if(eepromlocation == 7) base_number = 1792u;/*rownumber = 112u;*/

/* Read Data */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number;

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

    }

    unit_lower = row_read[1];

    unit_upper = row_read[2];

   

    return_unit = 0u;

    return_unit = unit_upper;

    return_unit = return_unit << 8;

    return_unit = return_unit | unit_lower;

    return(return_unit);

}

/* end function "read_unitinterval_from_eeprom" */

 

 

 

 

 

 

Next function reads the 224 location array and stores it in a global variable.  I tried to return the array but I was not able to write a function that returns an array.  All my attempts resulted in compilation errors, but this global variable approach works fine. Here is the function code:

 

 

 

 

/* function read array from one of the 8 code locations in eeprom */

/* and store values in an array defined in the main section: codebuffer[224] */

/* locationnumber is one of the 8 IR command code locations in eeprom: 0,1,2...7 */

void read_array_from_eeprom (uint8 locationnumber)

{

reg8 * RegPointer;

RegPointer = (reg8 *)CYDEV_EE_BASE;

uint16 Index;

uint8 eepromlocation = locationnumber;

uint8 row_read[SIZEOF_EEPROM_ROW];

uint16 base_number;

uint8 rowincrement;

 

 

 

 

 

 

if(eepromlocation == 0) base_number = 0u;/*rownumber = 0u ;*/

if(eepromlocation == 1) base_number = 256u;/*rownumber = 16u ;*/

if(eepromlocation == 2) base_number = 512u;/*rownumber = 32u;*/

if(eepromlocation == 3) base_number = 768u;/*rownumber = 48u;*/

if(eepromlocation == 4) base_number = 1024u;/*rownumber = 64u;*/

if(eepromlocation == 5) base_number = 1280u;/*rownumber = 80u;*/

if(eepromlocation == 6) base_number = 1536u;/*rownumber = 96u;*/

if(eepromlocation == 7) base_number = 1792u;/*rownumber = 112u;*/

 

 

rowincrement = 16;

 

 

/* Temporary Read Data from row 0 and write values into array (row1 has the vlues for carrier freq., unit intrval, ... */

    RegPointer = (reg8 *) CYDEV_EE_BASE+base_number+rowincrement; /* red row 2; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(1 - 1) + Index] = row_read[Index];

        temparray[Index] = row_read[Index];

    }

 

 

/* Read Data from row 2 and write values into array (row1 has the vlues for carrier freq., unit intrval, ... */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 1*rowincrement; /* red row 2; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        /*codebuffer[rowincrement*(1 - 1) + Index] = row_read[Index];*/

    }

 

/* Read Data from row 3 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 2*rowincrement; /* red row 3; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(2 - 1) + Index] = row_read[Index];

    } 

   

/* Read Data from row 4 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 3*rowincrement; /* red row 4; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(3 - 1) + Index] = row_read[Index];

    } 

/* Read Data from row 5 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 4*rowincrement; /* red row 5; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(4 - 1) + Index] = row_read[Index];

    } 

/* Read Data from row 6 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 5*rowincrement; /* red row 6; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(5 - 1) + Index] = row_read[Index];

    } 

/* Read Data from row 7 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 6*rowincrement; /* red row 7; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(6 - 1) + Index] = row_read[Index];

    } 

/* Read Data from row 8 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 7*rowincrement; /* red row 8; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(7 - 1) + Index] = row_read[Index];

    } 

/* Read Data from row 9 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 8*rowincrement; /* red row 9; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(8 - 1) + Index] = row_read[Index];

    } 

/* Read Data from row 10 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 9*rowincrement; /* red row 10; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(9 - 1) + Index] = row_read[Index];

    } 

/* Read Data from row 11 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 10*rowincrement; /* red row 11; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(10 - 1) + Index] = row_read[Index];

    } 

/* Read Data from row 12 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 11*rowincrement; /* red row 12; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(11 - 1) + Index] = row_read[Index];

    } 

/* Read Data from row 13 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 12*rowincrement; /* red row 13; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(12 - 1) + Index] = row_read[Index];

    } 

/* Read Data from row 14 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 13*rowincrement; /* red row 14; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(13 - 1) + Index] = row_read[Index];

    } 

/* Read Data from row 15 and write values into array */

    RegPointer = (reg8 *) CYDEV_EE_BASE + base_number + 14*rowincrement; /* red row 15; row 1 has carrier freq,...*/

    for(Index = 0u; Index < SIZEOF_EEPROM_ROW; Index++)

    {

        row_read[Index] = RegPointer[Index];

        codebuffer[rowincrement*(14 - 1) + Index] = row_read[Index];

    } 

}

/* end function "read_unittrim_from_eeprom" */

 

 

After writing these functions I spent a significant time debugging the program to make it work.  It was great that I worked on the Cypress CY8CKIT-001  evaluation board.  Without this board I don’t think I cold have done this task.  The debugger in PSoC creator was very useful and also the LCD display of the evaluation board allowed me to write  various “debug/test” messages along the code execution time, which give me an insight in what the algorithm and functions do and where problems are.

 

 

This is where I’ve gotten so far with developing the code learning algorithm.  Next step I’ll need to write a user interface that would select in which location the code will be stored and will provide a way to verify that the code was stored without errors.

 

 

That’s it for now; I will come back with a new update as I get more work done.

 

 

Best Wishes,

Cosmin