View previous topic :: View next topic |
Author |
Message |
ortegahernandes
Joined: 14 Feb 2020 Posts: 23
|
Fixed voltage ( 0.6V) in pic16f886 |
Posted: Wed Feb 02, 2022 10:16 am |
|
|
Good afternoon everyone.
in the datasheet of pic 16f886 it is indicating that it has a fixed voltage of 0.6V for reference.
But I didn't find how to configure
I tried to set the bits
FVREN = 1;
C2RSEL = 1; (I've tried 0 too)
VROE (I've tried 1 and 0), but without success.
needed this output to do an adc adjustment to find the closest power supply (~5V) in real time as it fluctuates under some conditions.
In the DSPIC 33ch128MP506 I could easily get this reference in the case it was 1.2V. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Wed Feb 02, 2022 11:41 am |
|
|
You can't us it as the ADC Vref.
The voltage reference on this chip can be used in two ways.
First, it is available for the comparator.
Second it can be _read_ by the ADC.
If you look in the ADC channel selections in the .h file you will find
it available as an input channel.
It cannot be used as a reference for the ADC.
The idea is that you can use the supply as the reference for the ADC,
and then read the internal reference using this, which allows you to
work out what the supply voltage is.
In the electrical characteristics you will find:
"ADC VREF is from external VREF or VDD pin, whichever is selected as
reference input."
Also the absolute minimum value for this is 2.2v.
Even on your DsPIC, you should check again. Most of the internal VREF''s
need to use the *2 selection to be legal for the ADC, otherwise accuracy
plummets. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Wed Feb 02, 2022 3:14 pm |
|
|
re: needed this output to do an adc adjustment to find the closest power supply (~5V) in real time as it fluctuates under some conditions.
if you're saying VDD is changing ,you need to seriously redesign the power supply and use a precision voltage reference for the ADC Vref
I can't seem to find the specs for that 0.6v fixed reference in the datasheet I have. Am I going more blind as the dayze go on ?? |
|
|
ortegahernandes
Joined: 14 Feb 2020 Posts: 23
|
|
Posted: Wed Feb 02, 2022 5:29 pm |
|
|
Ttelmah
Thanks for the tip.
It has clarified enough the fact of being able to read the fixed reference.
In dspic I do the same thing,
I read the VBG (voltage bandgap) and do the calculation for it (for me the precision is satisfactory, it accompanies the multimeter to 3 decimal places). I thought that in 16f886 there was no internal reference that I could read this makes it a lot easier....
In dspic I basically do this (3V3) volts:
Code: |
#device ADC=12
unsigned int16 ajust = 3250;
unsigned int16 adc_ref = 0;
// set canal -----------------------------------------------------------
set_adc_channel (20);
adc_ref = read_adc();
adc_ref =(adc_ref *ajust)/4095;
if (adc_ref < 1200) ajust ++;
if (adc_ref > 1200) ajust --;
|
I leave a value close to the beginning, it will self-adjust to each adc cycle. |
|
|
ortegahernandes
Joined: 14 Feb 2020 Posts: 23
|
|
Posted: Wed Feb 02, 2022 5:39 pm |
|
|
temtronic wrote: | re: needed this output to do an adc adjustment to find the closest power supply (~5V) in real time as it fluctuates under some conditions.
if you're saying VDD is changing ,you need to seriously redesign the power supply and use a precision voltage reference for the ADC Vref
I can't seem to find the specs for that 0.6v fixed reference in the datasheet I have. Am I going more blind as the dayze go on ?? |
https://ww1.microchip.com/downloads/en/DeviceDoc/40001291H.pdf
First page
• Analog Comparator module with:
- Two analog comparators
- Programmable on-chip voltage reference (CVREF) module (% of VDD)
- Fixed voltage reference (0.6V)
- Comparator inputs and outputs externally accessible
- SR Latch mode- External Timer1 Gate (count enable)
So, you can't change the font, it's a closed product that I'm now modifying a piece of the firmware to compensate for that.... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Wed Feb 02, 2022 9:21 pm |
|
|
0.6v isn't the complete spec, it might vary 1%,4%,-2% ?
maybe it has a factory range of 0.595 to 0.610 ?
edited...
just read the spec sheet you supplied
YIKES ! according to table 17-9 that fixed ref of 0.6 can be anywhere between 0.5 and 0.7 volts !!!!
While it may be a 'fixed reference' it's NOT a 'precision' reference. You'd have to bench calibrate every PIC in order to use it as your ADC 'standard'. Running the ADC in 10 bit mode, will probably show problems in accurate readings.
Also the settling time is 'carved in stone' so you'll have to configure the ADC to ensure accurate reading of it as well. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Thu Feb 03, 2022 1:46 am |
|
|
Have to agree totally with Jay on this. It is a 'low precision Vref'.
It is however quite stable long term and with supply voltage changes.
So if you want to use it to measure your supply, you really have to perform
an initial calibration. Then make your own calculation of what the Vref
is actually giving. Store this, and in the future you can use this figure
which will be quite repeatable.
As a comment to the original poster, beware also of Tacq. Hopefully on the
DsPIC, you have a programmed Tacq, so you can read immediately after
selecting the channel, and the processor will automatically wait for this.
However on the 886, there is no hardware Tacq option, so you need to
delay for at least 4.67uSec after selecting the Vref channel, before taking
the reading. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Fri Feb 04, 2022 6:18 pm |
|
|
re: Quote: | It is however quite stable long term and with supply voltage changes. |
I can't see,well easily, any charts or tables(datasheet v.H) as to how 'stable' it is.
Call me the Cynical Canuck, but when a ref has a 'spec' of 0.5 to 0.7, NOTHING else !, that's not instilling faith in me. I'd prefer to spend a buck, use a high precision voltage reference chip and KNOW it's right from day one. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Fri Feb 04, 2022 10:59 pm |
|
|
It is internally a bandgap device. It just is not laser trimmed in
manufacture. Hence a wide spread of initial voltages, but good long term
stability and stability for voltage changes.
From my own experience using these, I'd say their stability is better
than 1%. However Microchip only say that this offers good stability, they
don't publish a figure for this. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Sat Feb 05, 2022 6:59 am |
|
|
Thanks Mr. T.... bandgap makes sense
for decades I used an LED in the gnd leg of a 5 volt Vreg to 'boost' Vout. Always humoured me how stable and consistant they were over years of use.
Yes, a 'cheat', never had one failed and it used existing inventory of parts. |
|
|
|