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?
microcontroller pic
add a comment |
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?
microcontroller pic
> 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
add a comment |
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?
microcontroller pic
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
microcontroller pic
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
add a comment |
> 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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
> 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