hemnath
Advanced Member level 3
Below is the test code for my Graphic LCD. Nothing problem with the code. But I would like to know any other code optimization is there to run the code faster.
Is my for and if loops are okey? or to increase code efficiency how can i modify it.
Is my for and if loops are okey? or to increase code efficiency how can i modify it.
Code:
for(m = 0; m < 3; m++)
{
glcd_command(address+m); // row address
glcd_command(upper_address);
glcd_command(lower_address); // column shift
for(i = 0; temp_value[i] != '\0'; i++)
{
if(temp_value[i] == '-') // temp_Value is minus
{
for(x = m; x < 24; x = x+3)
{
glcd_data(negative_22[temp_value[i]-45][x]);
}
}
if(temp_value[i] == '.') // temp_value is decimal
{
for(x = m; x < 24; x = x+3)
{
glcd_data(decimal_point_22[temp_value[i]-46][x]);
}
}
else if((temp_value[i] >= '0') && (temp_value[i] <= '9')) // temp_value is between 0 and 9
{
for(x = m; x < 48; x = x+3)
{
glcd_data(numbers_22[temp_value[i]-48][x]);
}
}
else
{
for(x = m; x < 48; x = x+3)
{
glcd_data(space_22[temp_value[i]-32][x]);
}
}
}
}