MPLABX V6.0, XC8 v2.40
At the start of the program:
Where the value of 'Text' is used:
The problem is that 'Text[NewText]' is nul and so the display is not written. This is regardless of the optimisation setting.
I added the code below to check the values in the array:
The array contents checked out OK, but with this code in place the display writing works correctly.
If necessary I can leave the extra code in place, but I cannot see why this happens.
At the start of the program:
Code:
enum DisplayText_t{OFF_T, MAINS_T, REMAINING_T, RAW_T, LIMIT_T, LIMIT_PLUS_T, LIMIT_MINUS_T};
const char *Text[] = {" ", "Mains ", "Spare ", "Raw ", "Limit ", "Limit+", "Limit-"};
Code:
SSD1306_GotoXY(1,3);
SSD1306_puts(Text[NewText], 2);
LastText = NewText;
I added the code below to check the values in the array:
Code:
uint8_t Test;
for(uint8_t i = 0; i < 7; i++)
{
Test = Text[0][i];
if(Test == 0x20)
NOP();
}
If necessary I can leave the extra code in place, but I cannot see why this happens.