Convert Adc Raw Data to Mv Reading

AvionicsLab775

New Fellow member

  • Total Posts : 5
  • Advantage points : 0
  • Joined: 2011/06/20 09:58:19
  • Location: 0
  • Status: offline

ADC value to Voltage Measurement

Hello Everyone.

I know this is going to sound ridiculous, but I can't seem to find what I'm looking for in the datasheet/reference manual then here it goes.

And then far as I know, my ADC is functioning perfectly, and I am able to get a reading from the desired analog input.  Now tin can someone prove me how to have the ADC reading and go far something meaningful? For instance, a measurement in mV or something.

Other processors I've used have described the relationship between ADC value and actual voltage measurement explicitly in the datasheet.  Only I can't seem to observe this in the PIC32MX Family unit Reference Manual (Section 17: 10-chip ADC).  I'm looking for a generic equation that relates the ADC reading, reference voltages, settings, etc to an bodily voltage measurement.  Can someone assistance me with this?

I'm using the PIC32MX795F512L ten-bit ADC, ADCref external.

Thanks for your help!

AvionicsLab

Kiwi Mike AZ

Super Member

  • Total Posts : 2060
  • Advantage points : 0
  • Status: offline

Re:ADC value to Voltage Measurement 2011/07/12 eleven:11:50 (permalink)

The Value you get back is proportional to the reference that you are using.

10 bits = 1024 steps (0 to 1023)

Then the calculation to work out the voltage for your result is:

 Result_mV = ( Reference in mV / 1023) * Result

And then for a reference of 3.3V (e.yard.  using Vdd/Vss as ref) and ADC result of 250:
Upshot = (3300/1023) * 250 = 806mV

Now if you are using a 2.048V external reference (you lot have not specified your external ref voltage)
Upshot = (2048/1023) * 250 = 500mV

Mike

AvionicsLab775

New Member

  • Full Posts : 5
  • Advantage points : 0
  • Joined: 2011/06/20 09:58:19
  • Location: 0
  • Status: offline

Re:ADC value to Voltage Measurement 2011/07/13 07:29:27 (permalink)

Thank you for your help with this.  I'thou sorry I forgot to mention I'thousand using a 3.3V reference.

Have a great mean solar day! :)

thulasi

Starting Member

  • Full Posts : 34
  • Advantage points : 0
  • Joined: 2011/06/15 22:17:37
  • Location: 0
  • Status: offline

Re:ADC value to Voltage Measurement 2011/08/17 01:58:18 (permalink)

I am trying to do a Ad conversion using MPLAB starter kit for PIC18F. I am using the PIC18F46J50.

I take used the post-obit code:

    TRISA = 0x20;

    ADCON0 = 0x11;
ADCON1 = 0x8A;

    ANCON0 = 0xE0;
ANCON1 = 0x1F;

/* Make certain A/D interrupt is non gear up */
PIR1bits.ADIF = 0;

    /* Begin A/D conversion */
ADCON0bits.Go=1;

      while(!PIR1bits.ADIF); //Wait for A/D convert complete
Vread = (((unsigned int)ADRESH)<<8)|(ADRESL); //Go the value from the A/D
PIR1bits.ADIF = 0; //Clear A/D Interrupt Flag

I have used "Starter Kits" as the debugger tool and after clicking on the "Program" button when I Run the project I obtain the post-obit values in the watch window:

ADRES = 0X031A  -> 794
Vread = 0X04FF   ->  1279

How am I supposed to interpret these values - i.eastward. does Vread store the value wrt 10 bit resolution (Reference voltage/1023) * 794 ?

DarioG

Allmächtig.

  • Full Posts : 54081
  • Reward points : 0
  • Joined: 2006/02/25 08:58:22
  • Location: Oesterreich
  • Status: offline

Re:ADC value to Voltage Measurement 2011/08/17 04:01:48 (permalink)

Hmm, yous'd ameliorate start a new thread of your own...

How can ADRES be unlike from the above Vread? Or are you already using a formula on Vread - that is not shown?

Generally speaking, yes, you can interpret the ADC output like y'all do.

xTommYx

New Member

  • Total Posts : 14
  • Reward points : 0
  • Joined: 2011/08/25 17:54:46
  • Location: 0
  • Status: offline

Re:ADC value to Voltage Measurement 2011/08/25 18:02:03 (permalink)

i've got the aforementioned trouble. i am getting a reading just i am not sure if its the correct reading !!
anyone ?

NKurzman

A Guy on the Net

  • Total Posts : 19545
  • Advantage points : 0
  • Joined: 2008/01/sixteen 19:33:48
  • Location: 0
  • Status: offline

Re:ADC value to Voltage Measurement 2011/08/25 19:32:50 (permalink)

Its R42

Details? Input, Input scaling?, VRef, Vdd, Bit?

 The A/D counts are a ratio to Vdd. 10 bits = 1024  one-half scale (512) is half Vref

KangarooBaby

New Member

  • Full Posts : fifteen
  • Reward points : 0
  • Joined: 2014/05/01 08:01:23
  • Location: 0
  • Status: offline

Re:ADC value to Voltage Measurement 2014/05/22 13:36:00 (permalink)

mimemike
The Value you become back is proportional to the reference that you are using.

10 $.25 = 1024 steps (0 to 1023)

So the adding to work out the voltage for your result is:

Result_mV = ( Reference in mV / 1023) * Result

Then for a reference of three.3V (eastward.g.  using Vdd/Vss as ref) and ADC effect of 250:
Event = (3300/1023) * 250 = 806mV

Now if you are using a 2.048V external reference (you lot have non specified your external ref voltage)
Result = (2048/1023) * 250 = 500mV

Mike

Hi Mike, this is really helpful. The positive voltage works fine using this adding. Just how practise you lot summate negative voltage? I'g using a PIC18 chip. The Advertising result register is ADRES: 16 bits, flake fifteen-12 are sign $.25 - positive is 1, negative is 0; bit eleven-0 are data bits. Say for example I use Vdd (+5V) and Vss as reference values. When I read the ADRES register for an input voltage of -1V, it gives issue of 0xFFB8.

 Thanks!

ric

Super Member

  • Total Posts : 33613
  • Reward points : 0
  • Joined: 2003/xi/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online

Re:ADC value to Voltage Measurement 2014/05/22 13:twoscore:59 (permalink) ☄ Helpful by KangarooBaby 2014/05/23 05:26:52

There are lots of PIC18 chips, y'all should be a bit more specific.
Most ADCs tin can NOT read values lower than Vref-.
In your example, Vref- is ground, then you tin can not read -1V correctly.
You should use external circuitry to shift the betoken to be entirely within Vref- and Vref+.

I also mail service at: PicForum
To go a useful answer, always state which Picture show y'all are using!

KangarooBaby

New Member

  • Total Posts : 15
  • Reward points : 0
  • Joined: 2014/05/01 08:01:23
  • Location: 0
  • Status: offline

Re:ADC value to Voltage Measurement 2014/05/23 05:25:47 (permalink)

ric
There are lots of PIC18 fries, you should be a bit more specific.
About ADCs tin can NOT read values lower than Vref-.
In your case, Vref- is ground, so you can non read -1V correctly.
You should use external circuitry to shift the signal to be entirely within Vref- and Vref+.

I see ric. Thank you lot very much! Then am I right the equation to summate the voltage should exist:
Result_mV = (Vref+ - Vref-)/2^n_steps * Result
?

ric

Super Member

  • Total Posts : 33613
  • Reward points : 0
  • Joined: 2003/eleven/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online

Re:ADC value to Voltage Measurement 2014/05/23 05:28:58 (permalink)

Result_mV = ((Vref+ - Vref-)/2^n_steps * Outcome) + Vref-

I also post at: PicForum
To get a useful respond, ever country which Motion picture you lot are using!

KangarooBaby

New Fellow member

  • Full Posts : xv
  • Reward points : 0
  • Joined: 2014/05/01 08:01:23
  • Location: 0
  • Status: offline

Re:ADC value to Voltage Measurement 2014/05/23 06:53:19 (permalink)

That's right. Forgot that office. Cheers ric!

Antonio_2706

Starting Member

  • Total Posts : 72
  • Reward points : 0
  • Joined: 2016/07/07 06:45:37
  • Location: 0
  • Condition: offline

Re:ADC value to Voltage Measurement 2017/02/07 12:17:55 (permalink)

"The Value you become dorsum is proportional to the reference that you are using.

10 bits = 1024 steps (0 to 1023)

And so the calculation to work out the voltage for your result is:

Result_mV = ( Reference in mV / 1023) * Issue

And then for a reference of 3.3V (e.g.  using Vdd/Vss every bit ref) and ADC result of 250:
Result = (3300/1023) * 250 = 806mV

Now if you are using a 2.048V external reference (you take not specified your external ref voltage)
Result = (2048/1023) * 250 = 500mV

Mike"

Hello Guys where 250 comes from ? I am using a PIC 16LF1526/7 10bit ADC 5V

Many Thanks
Antonio

CinziaG

die fucking humans

  • Total Posts : 3169
  • Advantage points : 0
  • Joined: 2016/12/07 14:20:36
  • Location: Wien
  • Status: offline

Re:ADC value to Voltage Measurement 2017/02/07 13:02:13 (permalink)

GlennP

Super Fellow member

  • Total Posts : 980
  • Reward points : 0
  • Joined: 2009/03/29 15:04:55
  • Location: El Paso County, CO, The states
  • Condition: offline

Re:ADC value to Voltage Measurement 2017/02/07 thirteen:58:38 (permalink)

Read the quote in your mail.  "ADC outcome of 250".

 GP

GlennP

Super Fellow member

  • Full Posts : 980
  • Reward points : 0
  • Joined: 2009/03/29 fifteen:04:55
  • Location: El Paso County, CO, USA
  • Condition: offline

Re:ADC value to Voltage Measurement 2017/02/07 14:00:08 (permalink)

Antonio_2706

Starting Member

  • Total Posts : 72
  • Advantage points : 0
  • Joined: 2016/07/07 06:45:37
  • Location: 0
  • Status: offline

Re:ADC value to Voltage Measurement 2017/02/10 03:38:55 (permalink)

Thank you very much guys.

 What i can not understand is : if i accept Threshold Voltage 0.6V. Using a ADC 10bit integrate into theMotion-picture show 16LF1526/7 10bit what is the minimum voltage input?. If i do 5/1024= 0.004V, the pic can read 0.004V?

Also if i want to read 0.167V my ADC gives me ~40mV. Do am i correct ?

Thanks very much
Cordially
Antonio

qhb

Superb Fellow member

  • Total Posts : 9999
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Condition: offline

Re:ADC value to Voltage Measurement 2017/02/10 04:07:51 (permalink)

Antonio_2706
What i can non sympathise is : if i have Threshold Voltage 0.6V. Using a ADC 10bit integrate into thePIC 16LF1526/seven 10bit what is the minimum voltage input?. If i practice 5/1024= 0.004V, the pic tin can read 0.004V?

You are confusing the performance of the digital input buffer with the ADC input.
The digital buffer is disabled when yous are using a pin in analog mode.


As well if i want to read 0.167V my ADC gives me ~40mV. Exercise am i correct ?

Please explain.
Practice y'all hateful you get 0.040V later doing the calculations?
What is the raw reading yous got?

Antonio_2706

Starting Member

  • Total Posts : 72
  • Reward points : 0
  • Joined: 2016/07/07 06:45:37
  • Location: 0
  • Condition: offline

Re:ADC value to Voltage Measurement 2017/02/ten 04:12:42 (permalink)

Ok, now become articulate. Yeah i meant later on calculation

 Cheers very much
Antonio

qhb

Superb Member

  • Full Posts : 9999
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Condition: offline

Re:ADC value to Voltage Measurement 2017/09/20 05:13:44 (permalink)

The front page says there is a post by "Prabhu R" at the cease of this topic, only it's not visible.
I suspect it contained a firewall trigger give-and-take, or a reference to an Apple tree product...

markhamveat1937.blogspot.com

Source: https://www.microchip.com/forums/m589143.aspx

0 Response to "Convert Adc Raw Data to Mv Reading"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel