Hey guys,
I'm currently in the process of trying to make a digital voltage meter(0-3.3V). However, I came across this problem. When increasing the voltage (using a potometer ), the progress bar is fairly proportional to the voltage. But, when decreasing the voltage, it tends to leave unwanted blocks. Technically, 1 block is 0.2V (3.3/16). Here is a video demonstrating my problem.
https://streamable.com/t5i0p
Here is my conversion code
And here is my Progression bar code:
I tried following this blog which one of the guys from here linked me : https://www.electronicsblog.net/arduino-lcd-horizontal-progress-bar-using-custom-characters/
However, since i'm not using arduino. I couldn't really follow it well.
I'm currently in the process of trying to make a digital voltage meter(0-3.3V). However, I came across this problem. When increasing the voltage (using a potometer ), the progress bar is fairly proportional to the voltage. But, when decreasing the voltage, it tends to leave unwanted blocks. Technically, 1 block is 0.2V (3.3/16). Here is a video demonstrating my problem.
https://streamable.com/t5i0p
Here is my conversion code
Code:
void realVoltage ()
{
unsigned short ADC_DATA;
ADC_DATA=read_adc(); //reads what ever value is and put into ADC DATA
cmdLCD(LCD_LINE1);
float voltage = (ADC_DATA*(3.3/4096)); //conversion adc to voltage conversion
printf( "Volts = %.3f", voltage); //printing to lcd
}
Code:
void ASignal (float q) //analogue signal. (q is adcvalue)
{
float divider = 255;
int sum = q/divider;
cmdLCD(LCD_LINE2);
for(int i = 0; i< sum + 1 ; i++)
if(i==sum)
{
putLCD(' ');
}
else putLCD(0xFF);
}
However, since i'm not using arduino. I couldn't really follow it well.