Hello,
For switch statments with a lot of labels, the simulator does not select the correct label. It produces a lot of exta instructions. If a few labels are used, then it works fine. Below is the sample code. For example, if level = 4, the simulator selects 12.
Thansks
switch(DISPLevelCode)
{
case 1: DISPGraphData = 0x03;
break;
case 2: DISPGraphData = 0x0F;
break;
case 3: DISPGraphData = 0x3F;
break;
case 4: DISPGraphData = 0xFF;
break;
case 8: DISPGraphData = 0x01;
break;
case 9: DISPGraphData = 0x07;
break;
case 10: DISPGraphData = 0x1F;
break;
case 11: DISPGraphData = 0x7F;
break;
case 12: DISPGraphData = 0xFF;
break;
default: DISPGraphData = 0x00;
Hello,
I wonder if this is an issue of optimisation by the compiler, since the same action occurs for case 4 and case 12. You could have equally written this code in the following form, and there would be no issue.
case 4:
case 12:
DISPGraphData = 0xFF; break;
Does the issue still occur if different values are assigned in each of the cases?
Regards,
Mac