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 support@ccsinfo.com

Internal Vref 18F67j50

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



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

Internal Vref 18F67j50
PostPosted: Sun Jul 07, 2019 5:28 pm     Reply with quote

Hi! im trying to configure the internal vref of a pic 18F67j50, but the adc reads always 1023.

Here is the config:
Code:

setup_vref(VREF_high | 15);
setup_adc_ports(sAN0| VSS_VREF);   
set_adc_channel(0);

but every time i read the ADC port, it returns 1023. If i test it without the VREF it works fine.

thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 07, 2019 7:27 pm     Reply with quote

The internal Vref generator is intended for the comparators, not the A/D.
temtronic



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

View user's profile Send private message

PostPosted: Sun Jul 07, 2019 8:05 pm     Reply with quote

I was curious, so I looked at the datasheet.
While it can't be used 'internally connected', you can access the Vref generator on pin RF5. You can connect that to the ADC Vref+ input pin ( AN3). That 'should' work, HOWEVER be sure to read the ADC specs for the allowable value Vref+ can be. That'll be in the back of the datasheet ( electrical specs...) Also you'll probably need to buffer the Vref output (that's in the datasheet too....)
It might be worth the 1/2 day to 'work it out, on the bench' to see if it'll do what you want. That all depends on your application.

Jay
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Mon Jul 08, 2019 8:25 am     Reply with quote

Back when I used a couple of PIC16Fxxxx they had a fixed voltage reference (FVR) module that allowed selecting a 1.024, 2.048, or 4.096V internally generated reference for the ADC. It was convenient. I wonder why they didn't put that over to other PICs as well.
championx



Joined: 28 Feb 2006
Posts: 151

View user's profile Send private message

PostPosted: Thu Jul 11, 2019 8:17 pm     Reply with quote

Hi! thanks for your answers... yes, sadly, this pic does not have FVR... I can't use the external Vref pin because its already mapped on the board.

I guess i should make a capacitor discharge time measurement to use this pin as ADC.


Thanks!
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