CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

ADC VREF
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MCUprogrammer



Joined: 08 Sep 2020
Posts: 221

View user's profile Send private message

ADC VREF
PostPosted: Mon Feb 13, 2023 5:22 am     Reply with quote

Hi
dsPIC30F3014
CCS C 5.114

I would like to ask a few questions about this processor and ADC.
* Does the ADC read the VREF voltage when I use the VREF pin? Let's say I set VREF to 4.5v. How does it know it's 4.5v? Or does it understand that I've set it to something other than 4.5v?
* I gave the MCU supply 5v. But with its operation, this 5V can be 5.1 or 4.90 in some cases. Is it okay if I give precise 5V to the VREF input with the ADC voltage IC? So the supply is 4.9v but VREF 5.0v. Would something like this cause problems?
In which part of the datasheet is such information located?

* Also, can you suggest an ADC VREF IC with a maximum sensitivity of 0.3%? Is there a product you use that you are satisfied with working with?
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Mon Feb 13, 2023 7:02 am     Reply with quote

The ADC has no knowledge at all of what the Vref is.
That is completely down to your software. The step size of the ADC is
1/4096th the Vref.

Vin = ((ADRESH-ADRESL)/4096)*count

All readings are _relative_ to whatever the selected Vref actually is.

Look at the family reference manual, ADC section.

Yes, of course it matters if the reference changes.

The PIC ADC's all exhibit a sightly shifted transfer function from the
supposed 'ideal' function, reaching their maximum value one step
early of the theoretical value, hence you have to use the /1024 or /4096
rather than /1023 or /4095. Effectively the the PIC ADC's would actually
have to give 1024 counts (10bit) or 4096 counts (12bit) for the full Vref
voltage, but can't actually give this value. so give their maximum reading
1.5 steps early.

A good Vref, is something like the ZR40401F41TA, which is as good as
your ADC, but for some of the PIC's with a better ADC, the
MAX6126AASA41+ is what I use (much more expensive though).
Both of these in 4.096v, which makes the maths really easy.

Yes the Vref can be a fraction of a volt above the supply (0.3v).

The specifications of the ADC are the ADxx values in the data sheet, but
the overview of the ADC are in the family reference manual rather than
the datasheet. A lot of the figures are TBD, rather than given.... Sad
MCUprogrammer



Joined: 08 Sep 2020
Posts: 221

View user's profile Send private message

PostPosted: Mon Feb 13, 2023 7:16 am     Reply with quote

I understand. I think it would be better in terms of resolution if the output voltage is 5v. That's why I'm looking for an adjustable integrated. Is what you call "count" the value of adc value?
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 13, 2023 7:18 am     Reply with quote

I don't use that PIC but did download the datasheet.
Page 202, table 23-38 is where the 'information' is...

Most PICs have a similar 'ADC section' in them..

The PIC doesn't know what Vref+ or Vref- are , in a 'mathematical' sense ,you have to tell your program what it is.

The table above also shows the limits or range of what Vref can be and .3 volts seems to be a common factor in their math..

Almost any 'precision reference voltage' device can be used if '12 bit', when used 'on the bench' or in house. You need to really read the datasheets if using in very hot or cold conditions.

The major factor in using any ADC, especially 12 or 16 bit devices is PCB layout and filtering ! PCB traces must be correct size and distance, caps added as the datasheet says and the PCB HAS to be clean. All sensor cabling needs to be shielded, usually to one ground point. VDD needs to be well filtered and attention to EMI 'noise'. Be sure the PSU section has enough power (current). A current 'spike', say turning on a relay while an ADC is in progress, can give a bad reading.

Also measure the Vref voltage and use THAT as the 'Vref' in your program. Say you choose a 4.096 device. Do not assume it's 4.096. If it's actually 4.093, your 'math' will be off, not much ,but it won't be correct.

I'm sure others that use that PIC will reply
MCUprogrammer



Joined: 08 Sep 2020
Posts: 221

View user's profile Send private message

PostPosted: Mon Feb 13, 2023 7:31 am     Reply with quote

Well, what I'm really curious about is what happens when I give sensitive 5V to the VREF line while the supply voltage is 4.8V. Are there any errors in voltage readings?
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Mon Feb 13, 2023 7:46 am     Reply with quote

Not directly, but there are, if the main supply _fluctuates_. The AC changes
on this will cross couple into the ADC circuitry.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 13, 2023 9:54 am     Reply with quote

curious...I had a quick look at the MCP-1501 series of precision voltage reference devices. They have a 5.000 unit.
It requires a VDD of GREATER than 5 volts(5.2...5.5) so you cannot power it from the PIC VDD of 5 volts
It needs it's own power supply, decoupled from the PSU powering the PIC.

They do offer 4.500 and 4.096 though and 4.096 is a very,very commonly used Vref for 12 bit ADCs.....

Those can be powered from the PIC VDD source, properly decoupled of course.
MCUprogrammer



Joined: 08 Sep 2020
Posts: 221

View user's profile Send private message

PostPosted: Mon Feb 13, 2023 10:15 am     Reply with quote

Well AVDD and AVSS are the supply voltages used for analog. So if the voltage on AVdd drops to 4.8V and Vref+ is 5.0V, then a voltage of 4.8V and above on an analog pin will give you the max reading. Then I need to provide precise 5V for both VREF and AVDD supply voltage. Do we agree on this?
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Mon Feb 13, 2023 10:47 am     Reply with quote

Not really.
Seriously, to read a voltage accurately, the source needs to have a low
impedance. Hence for 90% of sources, you need to have op-amps to
feed the analog inputs. These can easily be wired to give a voltage division,
or amplification, so the range allowed to the ADC has no connection to
what can be read. Not having a good low impedance source is a sure way
not to get accuracy from the ADC.
My current project using the MAX6126AASA41+, is being fed from a
source that has over 50Gohm output impedance. The op-amp used has
to have a super high input impedance (>10^14ohms), and the PCB is
PTFE substrate. The instrument merrily passes accuracy and repeatability
checks at better than 0.05%.
Design, design, design.
You have to consider every parameter in what you are doing.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 13, 2023 12:17 pm     Reply with quote

dang, reminds me of when I used NE536 opamps, 32 at a time to buffer the PMT outputs in optical emission spectrometers...into 16 bit ADC, all INSIDE the EMI generator...

Realistically I could get 14 bits..never 16.
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Tue Feb 14, 2023 4:52 am     Reply with quote

Yes, and it is a thing that is commonly 'missed' in people's understanding
of ADC's. It is very common, to not understand the difference between
accuracy, and resolution. The ADC here has a 12bit resolution, but will
not achieve anything close to 12bit accuracy. The total error is specified
as sqrt((INL ^2)+(gain error^2)+(offset error^2)
Now in this case (unfortunately), maximum figures are not specified for
any of these.
Accuracy, is then resolution - log2(error).
From typical ADC's of this type, I'd expect accuracy to only be perhaps
9 or possibly at best 10 bits. So, perhaps about 10mV when working with
a 5v ref. Then the input driver, voltage reference etc., all add extra errors
to this. Genuinely getting accuracies up even to 14bits is really hard.
When dealing with things like 'sound' ADC's, genuine accuracy is not being
achieved, instead it is ensuring that a higher signal level always gives an
increasing output, that matters. This is why instruments with real even
15bit accuracies are so expensive. There is a lovely line from Analog
Devices:
Quote:

No presently available 16-bit ADC has an absolute accuracy of 15 ppm
relative to its full-scale input voltage. The best 16-bit ADCs have gain
errors of several least-significant bits LSBs. So even with a perfect voltage
reference their initial absolute accuracy is, at best, about 14-bits or so, off
the shelf.

You did very well to get to 14bits, and in this case the poster will have to
work very hard to get a genuine 9.5 bit accuracy.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Feb 14, 2023 7:06 am     Reply with quote

Used a lot of AD devices back then...
1st opamps I used were 'bricks', I think Teledyne ?
About 3 x 5 x 3 INCHES, 5 pins.
Technology has shrunk a bit since then....
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Tue Feb 14, 2023 2:54 pm     Reply with quote

Used some of the same kind of AD hardware "bricks" repairing sensors and
controls for US Steel QBOP blast furnace/rolling mill operations back in the early 80s.
_________________
Google and Forum Search are some of your best tools!!!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Wed Feb 15, 2023 2:17 am     Reply with quote

Where those modules vacuum tube based?.
Historically, these were not actually called 'op-amps'. They were 'high gain
inverting amplifier modules'. I remember some of the lab kit I first used
had these modules in. A company called Micro Gee made the ones I knew.
Then there were hybrid solid state modules doing the same job. The GAP/R
P65. Was available pretty much right through the 1960's. Wasn't as large
as you are describing though it was a plug in PCB, about the size of a
matchbox. There was also a P45 a little later. Had 9 pins in a ten pin size
connector (0.15" pitch I think). They then did a module version of this,
which I think was the PP65. Seven pins on a 0.2" pin spacing. So the
first thing starting to look like a modern 'IC'. They were a silly price. I think
about $200 rings a bell!... The ones I remember being really exciting, were
the next generation, in the early 1970's. Package about 5/8 inch across,
metal tin, with twelve legs (TO8 package I think). There were also some
similar hybrids in TO3. These were the ones I first really played with much.
These overlapped with IC op-amps, which began to appear, but the early
ones were pretty awful. Hands up who remembers the uA709... Horrible
the amount of frequency compensation you had to add outside the IC!.
I remember the uA741 launched the same year Apollo 8 orbited the Moon.
That was the first really easy to use 'op-amp', and by then the term had
really appeared.
Terrifying how long ago I was playing with electronics... Sad
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Feb 16, 2023 7:04 am     Reply with quote

ever have any xxx914s (?) to play with ?
RTL chips.... blob of epoxy with 6 pins, 2 transistors and resistor inside....

Currently cleaning out 'the basement', donating several boxes of electronic parts to local high school...sure beats 'landfilling' them ! Custom 5by7x2 SS boxes jammed with 4000 CMOS, the core of which any 18pin PIC would replace.
had a friend solder some silly SMD/SMT/XYZ ittybitty opamp onto a 'breakout PCB' so I could do 'proof of concept'. Needed +-30v signalling for a custom communications network.
Also found a Motorola '705KICS dev system.... Have a couple Intel 8008's here too....

Dang HOW do they make these 'ittybitties' !!!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group