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

18F46K80-NEW COMPILER Ver 4.121- [SOLVED] FIXED
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
w2drz



Joined: 27 Dec 2006
Posts: 55
Location: Western New York - USA

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

PostPosted: Sun May 08, 2011 2:24 pm     Reply with quote

PCM programmer wrote:
Read the A/D errata on page 3 of the 18F46K80 errata sheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/80519b.pdf
Does the errata explain your problems with the A/D ?


Hi,

Had read the errata prior and had seen the offset fix/needs,

Not a problem in my app. as the customer for AD use,
it will be normal to calibrate his setup usage to use a min set voltage for the AD input zero calibrate,
so the offset error is calibrated out and also does a max voltage calibrate for the range setting
between zero and max for AD use and read out in 16 bit range.
Just that high offset error is distracting when working with this chip.

You did not mention on the define used as being correct,

#define VSS 0xFF //Analog Negative Channel connected to Vss

That define works as I expect to connect the AD Vref- to VSS.

Thanks for your help on the FUSE setting I had missed,
now can finish the change over code to this chip as it looks.


Thank You,
TGM W2DRZ


SEE errata:
The 12-bit ADC issues will be fixed in a future
revision of this part.

ADC Offset
The ADC may have high offset error up to a
maximum of 25 LSB; it can be used if the ADC
is calibrated for the offset.

Work around
Calibrate for offset, in Single-Ended mode, by
connecting ADC +ve input to ground and taking
the ADC reading. This will be the offset of the
device and can be used to compensate for the
subsequent ADC readings on the actual inputs.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun May 08, 2011 3:11 pm     Reply with quote

Quote:
You did not mention on the define used as being correct,

#define VSS 0xFF //Analog Negative Channel connected to Vss

That define works as I expect to connect the AD Vref- to VSS

But you don't use the 'VSS' symbol any place in your program.
So what can it do ? Notice below that 'VSS' is not used:
Quote:

setup_adc_ports (sAN0|sAN1|sAN3|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_64|ADC_TAD_MUL_20);



I looked at the .LST file for the setup_adc_ports() function. I don't think
CCS allows you to set the CHS0 to CHSN2 bits with that function.
I think if you want to set those bits, then you need to write directly to
the ADCON1 register. Or, you can write directly to those bits.
You can use #bit statements to define the bit addresses.
Then write to them with code in main().
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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