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

12F1572, FVR as Vref+ for ADC?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
bschriek



Joined: 18 Dec 2007
Posts: 80

View user's profile Send private message Send e-mail

12F1572, FVR as Vref+ for ADC?
PostPosted: Wed Sep 12, 2018 3:17 am     Reply with quote

12F1572
Can I use the internal FVR as Vref+ for the ADC module?

Datasheet itself and CCS are contradictory.

NO; according the ADC block diagram at page 129 of the 12F1571/2 datasheet.
NO; according 15.1.3 at page 130 of the datasheet.
YES; according Register 15-2 ADCON1 (bit1-0) at page 136 of the datasheet.

YES; according 12F1572.h file of CCS.
SETUP_ADC_PORTS()
#define VSS_FVR 0x03000000 //| Range 0-FVR

But if I try to use the FVR as pos reference the AD result is random and doesn't change if I change the input voltage of the ADC.

Just curious what's right.
PCW compiler 5.080
temtronic



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

View user's profile Send private message

PostPosted: Wed Sep 12, 2018 5:11 am     Reply with quote

quick comments...

Now you've got me curious ! However IF the PIC ADC works fine with VDD being Vref and NOT with FVR as Vref, then I'd say FVR is NOT an option.
hmmm...looking at datasheet...
You should post a small test program though, as you'd have to setup FVR before the ADC, FVR MUST be set to X2 or X4 as the ADC Vref must be 1.8 or higher.
Jay
bschriek



Joined: 18 Dec 2007
Posts: 80

View user's profile Send private message Send e-mail

PostPosted: Wed Sep 12, 2018 6:40 am     Reply with quote

Sorry, all works fine.

The datasheet is not updated!
I tested with CCS and all 3 settings work fine!
Code:

setup_vref(VREF_ON|VREF_ADC_2v048|VREF_COMP_DAC_OFF|TEMPERATURE_INDICATOR_ENABLED | TEMPERATURE_RANGE_HIGH);
//setup_adc_ports(sAN2|VSS_VDD);
//setup_adc_ports(sAN2|VSS_FVR);
setup_adc_ports(sAN2|VSS_VREF);
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Sat Sep 15, 2018 1:05 am     Reply with quote

Yes. ADPREF is actually two bits selecting between three options (one unused), but pages 129 and 130, only seem to know about two of the options. Duh....

Obviously be aware of the limitation that 1.8v is the minimum allowed for Vref+ - Vref-. So your 2.048v setting is OK, but the 1.024v setting would not be.
bschriek



Joined: 18 Dec 2007
Posts: 80

View user's profile Send private message Send e-mail

PostPosted: Mon Sep 17, 2018 12:42 am     Reply with quote

Ok, thank you for your confirmation.

You are right,
TABLE 26-13 informs you about the minimum voltage span of the Vref input of the ADC module.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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