caddybran1977
New Member
we are using 8 bits and we tried
voltage = (x/255)*(5.0) and we got much larger numbers that had negative signs in front.
our range on x is 71 - 81
the original code is
while(1)
{
lcd_init();
lcd_goto(0) ;
lcd_puts("welcome " ) ;
lcd_goto(0x40);
x=read_a2d(1);
voltage=(x/255.0)*(5.0);
sprintf(outString,"A2D = %d.%d volts",voltage);
lcd_puts(outString);
}
}
so if i comment out voltage and display x my range is 71-81
voltage = (x/255)*(5.0) and we got much larger numbers that had negative signs in front.
our range on x is 71 - 81
the original code is
while(1)
{
lcd_init();
lcd_goto(0) ;
lcd_puts("welcome " ) ;
lcd_goto(0x40);
x=read_a2d(1);
voltage=(x/255.0)*(5.0);
sprintf(outString,"A2D = %d.%d volts",voltage);
lcd_puts(outString);
}
}
so if i comment out voltage and display x my range is 71-81