PDA

View Full Version : Quantasizing Formula



LLEEDD
- 10th June 2007, 10:00
Hello,
I set up a variable source of 0-25V and I intend to measure the tension and to show in one
display. I learned on the command " how much level " that is to measure of
0-5V (to See book " Experimenting with the PicBasic Pro Compiler " - Section
4-18). somebody already used that command, with the due adaptations,
to measure 0-25V? I already made 1023*/1250 to generate 5V approximately and
I multiplied for 5, to give the 25V. The results starting from the reading
of 6 or 7v they begin to present a mistake of volt hundredths that
increase with the increase of the tension of POWER. I using a PIC16F877A. Below it follows the part of the reading AD.

ADCIN PORTA.0, VALOR_AD0
AUX1 = VALOR_AD0 */ 1250
AUX2 = AUX1 * 5
TEN_VOLT = AUX2 / 10000
AUX3 = TEN_VOLT * 10000
AUX4 = AUX2 - AUX3 '
UNIT_VOLT = AUX4 / 1000
AUX5 = UNIDADE_VOLT * 1000
AUX6 = AUX4 - AUX5
DECIMAL_VOLT = AUX6 / 100

Darrel Taylor
- 10th June 2007, 11:39
Here's a different way to do it that should be a little more accurate.

2010

Just change the Res1 and Res2 variables to match your voltage divider.
<br>

LLEEDD
- 14th June 2007, 12:42
Here's a different way to do it that should be a little more accurate.

2010

Just change the Res1 and Res2 variables to match your voltage divider.
<br>

Thank you for the help,
I tested his/her program but it presents the same problems of mine. With the increase of the tension of the source, 0-25V, the mistake is going increasing, that it begins with 1mV for 10V of the source and it arrives to 8mV with 24V of the source.

Thank you,
LLEEDD

Ioannis
- 15th June 2007, 07:02
Hmmm, I don't see how you can be more accurate since:

1. For 8bit ADC, each step is 25/255=0.098 Volts

2. For 10bit ADC, each step is 25/1023=0.0244 Volts.

May be you have to use an external ADC with more resolution.

Ioannis