Page 1 of 1
MIAC Volt Meter
Posted: Tue Mar 30, 2010 7:19 am
by mimiyum
I tried the Digital Volt meter sample program on my MIAC. That works fine resulting it voltage readings of up to 1 decimal point.
In my attempt to get a reading of up to 2 decimal points, I edited the program and when I download this to my MIAC, I get a zero reading instead. Can you please check my program to see what I did wrong. By the way, simulation of this program works fine. I just doesn't work on the actual MIAC.
Thanks!
Re: MIAC Volt Meter
Posted: Tue Mar 30, 2010 9:11 am
by Sean
Hello,
The calculations are failing at the line:
Voltage = Value/19.6
Floating-point values can not be used in integer calculations.
The MIAC analog inputs have been designed to provide a simpler conversion between the ADC value and true voltage. The divider of 20 should provide you with an accurate conversion (<1% error).
I have run your program successfully with the line modified to:
Voltage = Value/20
Re: MIAC Volt Meter
Posted: Wed Mar 31, 2010 7:30 am
by mimiyum
Thanks Sean! That works fine.
Errr...can we work around the computations to get another digit? I want to get figures like 1.234 volts?
Is the factor really 2 or is it 1.96 or another number?
Thanks again!
Re: MIAC Volt Meter
Posted: Wed Mar 31, 2010 2:03 pm
by Sean
The ideal conversion factor for ADC input value (8-bit mode) to voltage is 19.968 (79.872 for 10-bit). This part of the circuit uses resistors with a 1% tolerance, so 20 is a realistic approximation.
Using either 8- or 10-bit conversions, there is a limit of a maximum of 2 decimal places of resolution when displaying the measured voltage.
10-bit mode can be useful for detecting smaller voltage changes than 8-bit can detect (precision), but the absolute values should only be considered to be accurate to apprximately 1% or 50mV, whichever is greater (12.5mV for 10-bit).
Re: MIAC Volt Meter
Posted: Wed Mar 31, 2010 2:47 pm
by mimiyum
Thanks Sean for your very clear explanation! It puts things into proper perspective for me.
Re: MIAC Volt Meter
Posted: Wed Mar 31, 2010 8:20 pm
by medelec35
mimiyum wrote:Errr...can we work around the computations to get another digit? I want to get figures like 1.234 volts?
I have done that for you and I have changed resolution from 8 bit to 10 bit and used 79.872 as a value in the calculations. The only purpose of doing all of these is to demonstrate how it is achieved for educational purposes. As you know Sean and Ben + Sean (in a different post) said would not improve accuracy since accuracy is determined by resistors and opamp. Hope it helps you.
![DVM.jpg](./download/file.php?id=1865&sid=4012a7e69acc1049ca568219207c9eec)
- DVM.jpg (37.32 KiB) Viewed 8947 times
Re: MIAC Volt Meter
Posted: Fri Apr 02, 2010 2:17 am
by mimiyum
Thanks Medelec for the demonstration. I was really using this for my educational purposes---as a way to learn more about accurate ADC reading for other applications.
Now, I will attempt to apply the concept on a 16F88 or 16F877a.
Thanks again!