Internal Voltage Reference_Solved!
Moderator: Benj
-
- Flowcode V4 User
- Posts: 36
- Joined: Mon Sep 26, 2011 10:26 pm
- Has thanked: 9 times
- Been thanked: 2 times
Internal Voltage Reference_Solved!
Hi!
I wonder, can we use the internal voltage reference for AD conversion for more precision?
For ex.16f1827 have Fixed Voltage Reference (FVR) with 1.024V, 2.048V and 4.096V
I would prefer 2.048V in my project.
In flowcode v4.5 Vref option for ADC are just VDD and VREF+. Is internal Voltage Reference not supported then?
How can we solve it?
Very grateful!
I wonder, can we use the internal voltage reference for AD conversion for more precision?
For ex.16f1827 have Fixed Voltage Reference (FVR) with 1.024V, 2.048V and 4.096V
I would prefer 2.048V in my project.
In flowcode v4.5 Vref option for ADC are just VDD and VREF+. Is internal Voltage Reference not supported then?
How can we solve it?
Very grateful!
Last edited by Dmitry Maximenko on Wed Oct 05, 2011 10:15 pm, edited 2 times in total.
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Internal Voltage Reference
Dear Dmitry
In the datasheet of 16F1827 you see the reference voltage can be used for ADC. The register FVRCON has to be set to 0x82 (8 for FVR enabled and 2 for 2.048 V for ADC)
You can realise this with the C-code:
fvrcon= 0x82;
And set ADC to the Vref+ with 205 x 10 mV reference voltage.
Good Luck
Jan Lichtenbelt
PS: Mind the ADC error in the 16F1827
http://www.matrixmultimedia.com/mmforum ... =29&t=8746
In the datasheet of 16F1827 you see the reference voltage can be used for ADC. The register FVRCON has to be set to 0x82 (8 for FVR enabled and 2 for 2.048 V for ADC)
You can realise this with the C-code:
fvrcon= 0x82;
And set ADC to the Vref+ with 205 x 10 mV reference voltage.
Good Luck
Jan Lichtenbelt
PS: Mind the ADC error in the 16F1827
http://www.matrixmultimedia.com/mmforum ... =29&t=8746
-
- Flowcode V4 User
- Posts: 36
- Joined: Mon Sep 26, 2011 10:26 pm
- Has thanked: 9 times
- Been thanked: 2 times
Re: Internal Voltage Reference
Hello Jan! Thank you and I have more questions:-) hope it´s ok.
If we look in a data sheet side 136 for pic16f1827:
-----------------------------------
14.3FVR Control Registers
bit 7 FVREN: Fixed Voltage Reference Enable bit
0 =Fixed Voltage Reference is disabled
1 =Fixed Voltage Reference is enabled
bit 6 FVRRDY: Fixed Voltage Reference Ready Flag bit
0 =Fixed Voltage Reference output is not ready or not enabled
1 =Fixed Voltage Reference output is ready for use
bit 5-4 Reserved: Read as ‘0’. Maintain these bits clear.
bit 3-2 CDAFVR<1:0>: Comparator and DAC Fixed Voltage Reference Selection bit
00 =Comparator and DAC Fixed Voltage Reference Peripheral output is off.
01 =Comparator and DAC Fixed Voltage Reference Peripheral output is 1x (1.024V)
10 =Comparator and DAC Fixed Voltage Reference Peripheral output is 2x (2.048V)
11 =Comparator and DAC Fixed Voltage Reference Peripheral output is 4x (4.096V)
bit 1-0 ADFVR<1:0>: ADC Fixed Voltage Reference Selection bit
00 =ADC Fixed Voltage Reference Peripheral output is off.
01 =ADC Fixed Voltage Reference Peripheral output is 1x (1.024V)
10 =ADC Fixed Voltage Reference Peripheral output is 2x (2.048V)
11 =ADC Fixed Voltage Reference Peripheral output is 4x (4.096V)
-----------------------
1)How did you get 0x82?
If I convert hex to bin :82= 10000010
2)for (4.096V)then 10000011= fvrcon= 0x83; ?
And set ADC to the Vref+ with ??? mV reference voltage for best resolution?.
I suppose that if I have 5 volts on vdd for my PIC then it better to use 4.096 volt fixed for best resolution and precision, right?
How about bit 6 FVRRDY? shall we leave it 0. (0= Voltage Reference output is not ready or not enabled)
3)Can I place C code box(fvrcon= 0x82;) for activating of internal reference in the beginning of program?
Thank you for help!
Best Regards
If we look in a data sheet side 136 for pic16f1827:
-----------------------------------
14.3FVR Control Registers
bit 7 FVREN: Fixed Voltage Reference Enable bit
0 =Fixed Voltage Reference is disabled
1 =Fixed Voltage Reference is enabled
bit 6 FVRRDY: Fixed Voltage Reference Ready Flag bit
0 =Fixed Voltage Reference output is not ready or not enabled
1 =Fixed Voltage Reference output is ready for use
bit 5-4 Reserved: Read as ‘0’. Maintain these bits clear.
bit 3-2 CDAFVR<1:0>: Comparator and DAC Fixed Voltage Reference Selection bit
00 =Comparator and DAC Fixed Voltage Reference Peripheral output is off.
01 =Comparator and DAC Fixed Voltage Reference Peripheral output is 1x (1.024V)
10 =Comparator and DAC Fixed Voltage Reference Peripheral output is 2x (2.048V)
11 =Comparator and DAC Fixed Voltage Reference Peripheral output is 4x (4.096V)
bit 1-0 ADFVR<1:0>: ADC Fixed Voltage Reference Selection bit
00 =ADC Fixed Voltage Reference Peripheral output is off.
01 =ADC Fixed Voltage Reference Peripheral output is 1x (1.024V)
10 =ADC Fixed Voltage Reference Peripheral output is 2x (2.048V)
11 =ADC Fixed Voltage Reference Peripheral output is 4x (4.096V)
-----------------------
1)How did you get 0x82?
If I convert hex to bin :82= 10000010
2)for (4.096V)then 10000011= fvrcon= 0x83; ?
And set ADC to the Vref+ with ??? mV reference voltage for best resolution?.
I suppose that if I have 5 volts on vdd for my PIC then it better to use 4.096 volt fixed for best resolution and precision, right?
How about bit 6 FVRRDY? shall we leave it 0. (0= Voltage Reference output is not ready or not enabled)
3)Can I place C code box(fvrcon= 0x82;) for activating of internal reference in the beginning of program?
Thank you for help!
Best Regards
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Internal Voltage Reference
Hi Dmitry,
1) With 0x82 or bin 1000 0010 FVREN bit7=1 and ADFVR<1:0> = 10 or ref. voltage is 2.048 Volt. I choose FVRRDY bit6=0 in the case you do not need the reference voltage on the output.
2) Indeed 4.096 Volt is 0x83. For the rest I'm not a ADC specialist. Perhaps someone else can help you, or you try the different options yourself!
3) Indeed you can put the C-code at the beginning of the program, before you use the ADC.
Succes
Jan lichtenbelt
1) With 0x82 or bin 1000 0010 FVREN bit7=1 and ADFVR<1:0> = 10 or ref. voltage is 2.048 Volt. I choose FVRRDY bit6=0 in the case you do not need the reference voltage on the output.
2) Indeed 4.096 Volt is 0x83. For the rest I'm not a ADC specialist. Perhaps someone else can help you, or you try the different options yourself!
3) Indeed you can put the C-code at the beginning of the program, before you use the ADC.
Succes
Jan lichtenbelt
Last edited by Jan Lichtenbelt on Fri Sep 30, 2011 10:50 am, edited 1 time in total.
-
- Flowcode V4 User
- Posts: 36
- Joined: Mon Sep 26, 2011 10:26 pm
- Has thanked: 9 times
- Been thanked: 2 times
Re: Internal Voltage Reference
Hi Jan,
I tried with fvrcon= 0x83; for 4.096V internal v.r.
And I changed in Vref Option to VREF+; Vref Voltage 401x10mV
Measurement became unstable. It jumped up and down. It felt like the PIC used the VREF pins that were not connected to anything and not to the Internal Voltage Reference. I have written C code in the c code box where I wrote the setting for the oscillator. (osccon = 0x68;
fvrcon= 0x83; ) What do you think, what could it be?
Thank you!
I tried with fvrcon= 0x83; for 4.096V internal v.r.
And I changed in Vref Option to VREF+; Vref Voltage 401x10mV
Measurement became unstable. It jumped up and down. It felt like the PIC used the VREF pins that were not connected to anything and not to the Internal Voltage Reference. I have written C code in the c code box where I wrote the setting for the oscillator. (osccon = 0x68;
fvrcon= 0x83; ) What do you think, what could it be?
Thank you!
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Internal Voltage Reference
Hi Dmitry,
Upload your flowcode file, so the Forum can help you.
And did you look at:
http://www.matrixmultimedia.com/mmforum ... =29&t=8746
Jan
Upload your flowcode file, so the Forum can help you.
And did you look at:
http://www.matrixmultimedia.com/mmforum ... =29&t=8746
Jan
-
- Flowcode V4 User
- Posts: 36
- Joined: Mon Sep 26, 2011 10:26 pm
- Has thanked: 9 times
- Been thanked: 2 times
Re: Internal Voltage Reference
Hi people,
Jan,thank you, I looked at the link you told about.
I have uploaded my FCD file with configuration for internal Voltage reference that not worked.
I tried to activate 4.096 volt internal voltage ref in C code as you recommended but unfortunately it does´t work:-(
I have added the file for PIC16F1827 for ADC stability so it worked nice when I use VDD+ as reference.
Please advice what to do to get Internal Voltage Reference to work.
Thank you!
Jan,thank you, I looked at the link you told about.
I have uploaded my FCD file with configuration for internal Voltage reference that not worked.
I tried to activate 4.096 volt internal voltage ref in C code as you recommended but unfortunately it does´t work:-(
I have added the file for PIC16F1827 for ADC stability so it worked nice when I use VDD+ as reference.
Please advice what to do to get Internal Voltage Reference to work.
Thank you!
- Attachments
-
- Sampling and outputting to a LCD.fcf
- (8 KiB) Downloaded 549 times
Last edited by Dmitry Maximenko on Sat Oct 01, 2011 4:07 pm, edited 1 time in total.
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Internal Voltage Reference
Hi Dmitry,
If you use an external oscillator, delete osccon. If you like to use the internal oscillator, you should set the SCS<1:0> enable bits of the osccon register to 10. That means osccon = 0x6A; should be used in stead of osccon = 0x68;
Kind regards
Jan
If you use an external oscillator, delete osccon. If you like to use the internal oscillator, you should set the SCS<1:0> enable bits of the osccon register to 10. That means osccon = 0x6A; should be used in stead of osccon = 0x68;
Kind regards
Jan
-
- Flowcode V4 User
- Posts: 36
- Joined: Mon Sep 26, 2011 10:26 pm
- Has thanked: 9 times
- Been thanked: 2 times
Re: Internal Voltage Reference
HI,
Yes I use internal oscillator 4 MHz.
Please, someone who can, advise what to do with internal voltage reference. It doesn´t work yet.
Thank you!
Yes I use internal oscillator 4 MHz.
Please, someone who can, advise what to do with internal voltage reference. It doesn´t work yet.
Thank you!
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Internal Voltage Reference_Not solved
Hello,
Here is an updated ADC file with code to hard code in the FVR as the +VREF signal.
You will also need the line of C code near the start of your program to set up the FVR.
E.G.
Here is an updated ADC file with code to hard code in the FVR as the +VREF signal.
You will also need the line of C code near the start of your program to set up the FVR.
E.G.
Code: Select all
fvrcon= 0x83;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode V4 User
- Posts: 36
- Joined: Mon Sep 26, 2011 10:26 pm
- Has thanked: 9 times
- Been thanked: 2 times
Re: Internal Voltage Reference_Not solved
HI Benjamin!
Power voltage for PIC16f1827 is 5 volt in my project.
What about Vref Voltage xxx x10mV parameter for A/D Properties?
If i use 4.096 Volt internal voltage, should it be 401 x10mV ? Or it does n´t meter what is xxx?
Thank you for reply!
Best Regards
Power voltage for PIC16f1827 is 5 volt in my project.
What about Vref Voltage xxx x10mV parameter for A/D Properties?
If i use 4.096 Volt internal voltage, should it be 401 x10mV ? Or it does n´t meter what is xxx?
Thank you for reply!
Best Regards
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Internal Voltage Reference_Not solved
Hello,
The Vref voltage in the component properties simply controls how the ReadAsVoltage and ReadAsFloat macros scale the incoming data to give you back a meaningful reading.
4.096V would be 409 or 410 in the component properties depending on which way you want to do it.
The Vref voltage in the component properties simply controls how the ReadAsVoltage and ReadAsFloat macros scale the incoming data to give you back a meaningful reading.
4.096V would be 409 or 410 in the component properties depending on which way you want to do it.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode V4 User
- Posts: 36
- Joined: Mon Sep 26, 2011 10:26 pm
- Has thanked: 9 times
- Been thanked: 2 times
-
- Posts: 323
- Joined: Tue Sep 06, 2011 2:54 am
- Has thanked: 166 times
- Been thanked: 26 times
Re: Internal Voltage Reference_Solved!
Hi.
I am trying to use FVR wit a pic 16F1939 using Flowcode5
However it just gives me random numbers
osccon=0x7A;
fvrcon= 0x82;
On the ADC properties I use Vref+ 205 X 10
Pin number 5 is also used for The LCD Display.
If I use VDD as a reverence voltage it works fine.
What could be the Problem?
Uli
I am trying to use FVR wit a pic 16F1939 using Flowcode5
However it just gives me random numbers
osccon=0x7A;
fvrcon= 0x82;
On the ADC properties I use Vref+ 205 X 10
Pin number 5 is also used for The LCD Display.
If I use VDD as a reverence voltage it works fine.
What could be the Problem?
Uli
-
- Flowcode V4 User
- Posts: 36
- Joined: Mon Sep 26, 2011 10:26 pm
- Has thanked: 9 times
- Been thanked: 2 times
Re: Internal Voltage Reference_Solved!
Hi,
It can be problem with ADC file in flow (for 16f1827is PIC_ADC_23.c). I have got new one from Benj.
Best Regards
Dmitry
It can be problem with ADC file in flow (for 16f1827is PIC_ADC_23.c). I have got new one from Benj.
Best Regards
Dmitry
-
- Posts: 323
- Joined: Tue Sep 06, 2011 2:54 am
- Has thanked: 166 times
- Been thanked: 26 times
Re: Internal Voltage Reference_Solved!
Does this file also work for the Pic 16F1939?Dmitry Maximenko wrote:Hi,
It can be problem with ADC file in flow (for 16f1827is PIC_ADC_23.c). I have got new one from Benj.
Best Regards
Dmitry
Uli
-
- Flowcode V4 User
- Posts: 36
- Joined: Mon Sep 26, 2011 10:26 pm
- Has thanked: 9 times
- Been thanked: 2 times
Re: Internal Voltage Reference_Solved!
No, I don´t think so. This file is for 16f1827. Please ask Benj on Flow forum. He answered me before.
He will surely respond by Monday. The guys are fast!
Best Regards
Dmitry
He will surely respond by Monday. The guys are fast!
Best Regards
Dmitry
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Internal Voltage Reference_Solved!
Hello,
This modified v5 CAL file should work with the 16F1939 device to use the internal VREF. A backup of the original CAL file should be made in case you need to use the same device or a similar device using the ADC normal settings.
The file should be placed into the following directory.
C:\Program Files\Flowcode\v5\CAL\PIC
or
C:\Program Files (x86)\Flowcode\v5\CAL\PIC
This modified v5 CAL file should work with the 16F1939 device to use the internal VREF. A backup of the original CAL file should be made in case you need to use the same device or a similar device using the ADC normal settings.
The file should be placed into the following directory.
C:\Program Files\Flowcode\v5\CAL\PIC
or
C:\Program Files (x86)\Flowcode\v5\CAL\PIC
- Attachments
-
- PIC_CAL_ADC.c
- (85.06 KiB) Downloaded 327 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 323
- Joined: Tue Sep 06, 2011 2:54 am
- Has thanked: 166 times
- Been thanked: 26 times
Re: Internal Voltage Reference_Solved!
Thanks for your Reply
At the moment I was intending use internal reference on only one ADC
Because on the other channels I want to have a higher Reference voltage.
Is it possible to have different reference voltages on different ADC channels?
Say 2048 on one and 4096 on the other? Do i have to enter the corresponding C code in front of each Adc Reading Macro?
Best regards:
Uli
At the moment I was intending use internal reference on only one ADC
Because on the other channels I want to have a higher Reference voltage.
Is it possible to have different reference voltages on different ADC channels?
Say 2048 on one and 4096 on the other? Do i have to enter the corresponding C code in front of each Adc Reading Macro?
Best regards:
Uli
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Internal Voltage Reference_Solved!
Hello Uli,
If you look at line 2155 of the updated component C file I sent you then you will see the following code.
If you change this to look like this,
And then create a byte variable in your program called adcvar then you can assign the two ADPREF bits to the lower two bits of your Flowcode variable. Make sure the variable is setup correctly before you call the ADC sample routine and it will use the reference as specified by your adcvar variable.
If you look at line 2155 of the updated component C file I sent you then you will see the following code.
Code: Select all
//Assign FVR functionality
st_bit(adcon1, ADPREF1);
st_bit(adcon1, ADPREF0);
Code: Select all
//Assign FVR functionality
if (FCV_ADCVAR & 0x02)
st_bit(adcon1, ADPREF1);
else
cr_bit(adcon1, ADPREF1);
if (FCV_ADCVAR & 0x01)
st_bit(adcon1, ADPREF0);
else
cr_bit(adcon1, ADPREF0);
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 323
- Joined: Tue Sep 06, 2011 2:54 am
- Has thanked: 166 times
- Been thanked: 26 times
Re: Internal Voltage Reference_Solved!
Hi Benj
Thanks for your reply
It is a bit too difficult for me to understand.
"then you can assign the two ADPREF bits to the lower two bits of your Flowcode variable"
I don understand at all because I only know Flowcode
Could you explain?
I filled in the code you Posted,
Also I created the variable but I do not know how to set the preferred reference voltage for each ADC.
I made an example program for reading the ADC where I would like to have a reference voltage of 1.024 on ADC(0)
And a reference voltage of 2.048 on ADC(1)
Could you fill in the missing parts?
Best Regards:
Uli
Thanks for your reply
It is a bit too difficult for me to understand.
"then you can assign the two ADPREF bits to the lower two bits of your Flowcode variable"
I don understand at all because I only know Flowcode
Could you explain?
I filled in the code you Posted,
Also I created the variable but I do not know how to set the preferred reference voltage for each ADC.
I made an example program for reading the ADC where I would like to have a reference voltage of 1.024 on ADC(0)
And a reference voltage of 2.048 on ADC(1)
Could you fill in the missing parts?
Best Regards:
Uli
- Attachments
-
- FVR.fcf
- (8 KiB) Downloaded 367 times
-
- Posts: 323
- Joined: Tue Sep 06, 2011 2:54 am
- Has thanked: 166 times
- Been thanked: 26 times
Re: Internal Voltage Reference_Solved!
Hi
Can someone explain what this Line Means?
if (FCV_ADCVAR & 0x02)
Does it mean "if (flowcode variable) adcvar=0X02" ?
Best Regards
Uli
Can someone explain what this Line Means?
if (FCV_ADCVAR & 0x02)
Does it mean "if (flowcode variable) adcvar=0X02" ?
Best Regards
Uli
-
- Posts: 323
- Joined: Tue Sep 06, 2011 2:54 am
- Has thanked: 166 times
- Been thanked: 26 times
Re: Internal Voltage Reference_Solved!
I have still not been able to figure out this one.
I have tried with a calculation before the ADC Macros "adcvar=0x02" and "adcvar=0x01" but it does not work
Also I tried to put the same C code in front of the ADC macros, this gives an error message.
Best Regards:
Uli
I have tried with a calculation before the ADC Macros "adcvar=0x02" and "adcvar=0x01" but it does not work
Also I tried to put the same C code in front of the ADC macros, this gives an error message.
Best Regards:
Uli
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Internal Voltage Reference_Solved!
Hello Uli,
It looks like you need to assign the correct +vref functionality in the ADC which was done previously and then configure the reference voltage before you start your ADC sample.
The line above ands the value 2 or 0x02 or 0b00000010 with the variable adcvar. If the bit is set then the if statement will return true and the line underneath will be called.if (FCV_ADCVAR & 0x02)
It looks like you need to assign the correct +vref functionality in the ADC which was done previously and then configure the reference voltage before you start your ADC sample.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 323
- Joined: Tue Sep 06, 2011 2:54 am
- Has thanked: 166 times
- Been thanked: 26 times
Re: Internal Voltage Reference_Solved!
Hi Benj
I finally made some progress.
I used the original PIC_CAL_ADC.c file as described.
Before each ADC is used the following c code: "fvrcon=0x83;" for 4.098 volt and "fvrcon=0x82;" for 2.048 volts
It works fine. (see attachment)
(I also tried "fvrcon=0x81;" for 1.024 volt but this did not work well, the readings become unstable. Also the datasheet for the Pic16F1939 does not state that you can use 1.024 for fvr as a reverence voltage, it only mentions 4.098 and 2.048)
This way I can change the Internal voltage reference and it gives good results, is this a good way of doing it?
Best Regards:
Uli
I finally made some progress.
I used the original PIC_CAL_ADC.c file as described.
Before each ADC is used the following c code: "fvrcon=0x83;" for 4.098 volt and "fvrcon=0x82;" for 2.048 volts
It works fine. (see attachment)
(I also tried "fvrcon=0x81;" for 1.024 volt but this did not work well, the readings become unstable. Also the datasheet for the Pic16F1939 does not state that you can use 1.024 for fvr as a reverence voltage, it only mentions 4.098 and 2.048)
This way I can change the Internal voltage reference and it gives good results, is this a good way of doing it?
Best Regards:
Uli
- Attachments
-
- FVR1.fcf
- (8.5 KiB) Downloaded 387 times