use pic10f222 internal absolute voltage refrence









up vote
0
down vote

favorite












I want to use PIC10f222 ADC and have no prolem in it :



#include <10F222.h> 
#list
#device PIC10F222
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOMCPU //Master Clear Pull-up disabled
#FUSES NOMCLR
#FUSES IOSC4 //INTOSC speed 4 MHz
#device adc=8
#use delay(internal=4000000)
#define set_options(value)#ASM
MOVLW value
OPTION
#ENDASM

setup_adc(true);
set_tris_b (0b111); //set as output
set_options(0xDF); // Enable pin B2 for normal i/o
set_adc_channel(0);
adc1=read_adc();


But, when when VDD changes the ADC shows different values (and that is also OK because the reference voltage is VDD).

I looked in PIC10F222 data sheet and found "absolute voltage refrence" that equals :

result = 0.6 * 256 / VDD
I thougth I can get VDD from the equation above and then get the precise adc value as follow:



adc_set_channel(2); 
adc1=read_adc();
vdd=0.6 * 256 / adc1 ;
adc_set_channel(0);
adc=read_adc();
//get the percise adc in popotion of VDD
....


But the adc1 (absolute voltage reference is not going to chane with different VDD from 4.9 to 5.2),

How can I fix this problem?










share|improve this question























  • > But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem?
    – Oleg Mazurov
    Nov 9 at 17:20










  • > But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem? Are you observing adc1 not changing while changing VDD? Or are you stating this? The latter is incorrect. In C, 'vdd=0.6 * 256 / adc1' will always result in zero, perhaps, that's why you see the behaviour you're describing.
    – Oleg Mazurov
    Nov 9 at 17:31






  • 1




    Your question, as asked, cannot be answered. Over the 4.9 to 5.2 VDD voltage range the ADC result will change about 1 or 2 counts. I do not see a solution in firmware for the PIC10F222.
    – Dan1138
    Nov 10 at 0:57











  • Why are you working with float values?
    – Mike
    2 days ago














up vote
0
down vote

favorite












I want to use PIC10f222 ADC and have no prolem in it :



#include <10F222.h> 
#list
#device PIC10F222
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOMCPU //Master Clear Pull-up disabled
#FUSES NOMCLR
#FUSES IOSC4 //INTOSC speed 4 MHz
#device adc=8
#use delay(internal=4000000)
#define set_options(value)#ASM
MOVLW value
OPTION
#ENDASM

setup_adc(true);
set_tris_b (0b111); //set as output
set_options(0xDF); // Enable pin B2 for normal i/o
set_adc_channel(0);
adc1=read_adc();


But, when when VDD changes the ADC shows different values (and that is also OK because the reference voltage is VDD).

I looked in PIC10F222 data sheet and found "absolute voltage refrence" that equals :

result = 0.6 * 256 / VDD
I thougth I can get VDD from the equation above and then get the precise adc value as follow:



adc_set_channel(2); 
adc1=read_adc();
vdd=0.6 * 256 / adc1 ;
adc_set_channel(0);
adc=read_adc();
//get the percise adc in popotion of VDD
....


But the adc1 (absolute voltage reference is not going to chane with different VDD from 4.9 to 5.2),

How can I fix this problem?










share|improve this question























  • > But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem?
    – Oleg Mazurov
    Nov 9 at 17:20










  • > But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem? Are you observing adc1 not changing while changing VDD? Or are you stating this? The latter is incorrect. In C, 'vdd=0.6 * 256 / adc1' will always result in zero, perhaps, that's why you see the behaviour you're describing.
    – Oleg Mazurov
    Nov 9 at 17:31






  • 1




    Your question, as asked, cannot be answered. Over the 4.9 to 5.2 VDD voltage range the ADC result will change about 1 or 2 counts. I do not see a solution in firmware for the PIC10F222.
    – Dan1138
    Nov 10 at 0:57











  • Why are you working with float values?
    – Mike
    2 days ago












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I want to use PIC10f222 ADC and have no prolem in it :



#include <10F222.h> 
#list
#device PIC10F222
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOMCPU //Master Clear Pull-up disabled
#FUSES NOMCLR
#FUSES IOSC4 //INTOSC speed 4 MHz
#device adc=8
#use delay(internal=4000000)
#define set_options(value)#ASM
MOVLW value
OPTION
#ENDASM

setup_adc(true);
set_tris_b (0b111); //set as output
set_options(0xDF); // Enable pin B2 for normal i/o
set_adc_channel(0);
adc1=read_adc();


But, when when VDD changes the ADC shows different values (and that is also OK because the reference voltage is VDD).

I looked in PIC10F222 data sheet and found "absolute voltage refrence" that equals :

result = 0.6 * 256 / VDD
I thougth I can get VDD from the equation above and then get the precise adc value as follow:



adc_set_channel(2); 
adc1=read_adc();
vdd=0.6 * 256 / adc1 ;
adc_set_channel(0);
adc=read_adc();
//get the percise adc in popotion of VDD
....


But the adc1 (absolute voltage reference is not going to chane with different VDD from 4.9 to 5.2),

How can I fix this problem?










share|improve this question















I want to use PIC10f222 ADC and have no prolem in it :



#include <10F222.h> 
#list
#device PIC10F222
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOMCPU //Master Clear Pull-up disabled
#FUSES NOMCLR
#FUSES IOSC4 //INTOSC speed 4 MHz
#device adc=8
#use delay(internal=4000000)
#define set_options(value)#ASM
MOVLW value
OPTION
#ENDASM

setup_adc(true);
set_tris_b (0b111); //set as output
set_options(0xDF); // Enable pin B2 for normal i/o
set_adc_channel(0);
adc1=read_adc();


But, when when VDD changes the ADC shows different values (and that is also OK because the reference voltage is VDD).

I looked in PIC10F222 data sheet and found "absolute voltage refrence" that equals :

result = 0.6 * 256 / VDD
I thougth I can get VDD from the equation above and then get the precise adc value as follow:



adc_set_channel(2); 
adc1=read_adc();
vdd=0.6 * 256 / adc1 ;
adc_set_channel(0);
adc=read_adc();
//get the percise adc in popotion of VDD
....


But the adc1 (absolute voltage reference is not going to chane with different VDD from 4.9 to 5.2),

How can I fix this problem?







microcontroller pic






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 12:10









Mike

1,5411421




1,5411421










asked Nov 9 at 16:43









Majid.r

3718




3718











  • > But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem?
    – Oleg Mazurov
    Nov 9 at 17:20










  • > But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem? Are you observing adc1 not changing while changing VDD? Or are you stating this? The latter is incorrect. In C, 'vdd=0.6 * 256 / adc1' will always result in zero, perhaps, that's why you see the behaviour you're describing.
    – Oleg Mazurov
    Nov 9 at 17:31






  • 1




    Your question, as asked, cannot be answered. Over the 4.9 to 5.2 VDD voltage range the ADC result will change about 1 or 2 counts. I do not see a solution in firmware for the PIC10F222.
    – Dan1138
    Nov 10 at 0:57











  • Why are you working with float values?
    – Mike
    2 days ago
















  • > But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem?
    – Oleg Mazurov
    Nov 9 at 17:20










  • > But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem? Are you observing adc1 not changing while changing VDD? Or are you stating this? The latter is incorrect. In C, 'vdd=0.6 * 256 / adc1' will always result in zero, perhaps, that's why you see the behaviour you're describing.
    – Oleg Mazurov
    Nov 9 at 17:31






  • 1




    Your question, as asked, cannot be answered. Over the 4.9 to 5.2 VDD voltage range the ADC result will change about 1 or 2 counts. I do not see a solution in firmware for the PIC10F222.
    – Dan1138
    Nov 10 at 0:57











  • Why are you working with float values?
    – Mike
    2 days ago















> But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem?
– Oleg Mazurov
Nov 9 at 17:20




> But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem?
– Oleg Mazurov
Nov 9 at 17:20












> But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem? Are you observing adc1 not changing while changing VDD? Or are you stating this? The latter is incorrect. In C, 'vdd=0.6 * 256 / adc1' will always result in zero, perhaps, that's why you see the behaviour you're describing.
– Oleg Mazurov
Nov 9 at 17:31




> But the adc1 (absolute voltage refrence is not going to chane with different VDD from 4.9 to 5.2), How can i fix this prroblem? Are you observing adc1 not changing while changing VDD? Or are you stating this? The latter is incorrect. In C, 'vdd=0.6 * 256 / adc1' will always result in zero, perhaps, that's why you see the behaviour you're describing.
– Oleg Mazurov
Nov 9 at 17:31




1




1




Your question, as asked, cannot be answered. Over the 4.9 to 5.2 VDD voltage range the ADC result will change about 1 or 2 counts. I do not see a solution in firmware for the PIC10F222.
– Dan1138
Nov 10 at 0:57





Your question, as asked, cannot be answered. Over the 4.9 to 5.2 VDD voltage range the ADC result will change about 1 or 2 counts. I do not see a solution in firmware for the PIC10F222.
– Dan1138
Nov 10 at 0:57













Why are you working with float values?
– Mike
2 days ago




Why are you working with float values?
– Mike
2 days ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53229922%2fuse-pic10f222-internal-absolute-voltage-refrence%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53229922%2fuse-pic10f222-internal-absolute-voltage-refrence%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo