Hi,
I got some data from this table. Can it be use using (for loop) ?
http://i.imgur.com/lq7WtWA.png
Recently, I used (if else) function, but it seem too longer.
I am new to C progrmming. Here the code (if else) funtion that I done:
if (0 < result < 409 ) // 0 to 408
{
volt = 0 ;
}
else if (409 < result < 818 ) //408 to 817
{
volt = 1 ;
}
else if (818 < result < 1227 ) //818 to 1226
{
volt = 2 ;
}
else if (1227 < result < 1636 ) //1227 to 1635
{
volt = 3 ;
}
else if (1636 < result < 2045 ) // 1636 to 2044
{
volt = 4 ;
}
else if (2045 < result < 2454 ) // 2045 to 2453
{
volt = 5 ;
}
else if (2454 < result < 2863 ) //2454 to 2862
{
volt = 6 ;
}
else if (3271 < result < 2863 ) //2863 to 3271
{
volt = 7 ;
}
else if (3860 < result < 3272 ) //3272 to 3860
{
volt = 8 ;
}
else if (4094 < result < 3861 ) //3861 to 4094
{
volt = 9 ;
}
else if (result >= 4095 ) //4095++
{
volt = 10 ;
}
Thanks.
Regrads,
nazif