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

12 Bit ADC?

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



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

12 Bit ADC?
PostPosted: Tue Nov 04, 2008 11:03 pm     Reply with quote

Hi

I was wondering if there are any PICs with built in 12 Bit ADC?

Thank you
a.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Tue Nov 04, 2008 11:53 pm     Reply with quote

Many dsPIC30 and PIC24H devices have 12 Bit ADC.
arrow



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

PostPosted: Tue Nov 04, 2008 11:59 pm     Reply with quote

Hi FvM

Thank you for your reply.
Does the PICC PCWH program these chips?

Regards
a.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Nov 05, 2008 1:11 am     Reply with quote

You need PCD respectively PCWHD compiler.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Nov 05, 2008 1:22 am     Reply with quote

Microchip makes many 18F-series PICs that have a 12-bit A/D.
See the Microchip Advanced Part Selector at the link below:
http://www.microchip.com/maps/microcontroller.aspx
How to use it:

1. Near the top, you will see 3 tickboxes. Uncheck the boxes for
16 and 32 bits, so only the 8 bit box is selected.

2. Go to the left-hand column, about 1/3 of the way down, and in the
row where it says "A/D Bits", set it to "12". The screen will automatically
update.

3. Now look in the top center at the scroll box called "Search Results".
It lists a lot of 18F parts that have a 12-bit A/D, for example the
18F4523.

4. You can click on the part number in the scroll box and the screen
will update with the specs of the PIC shown below the scroll box.

It would be much better to use an 18F part. You already have the
compiler. The PCH compiler is currently much more stable than PCD.
Do a search on all of FvM's recent posts to confirm this. I strongly
suggest using PCH at this time.
arrow



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

PostPosted: Wed Nov 05, 2008 1:43 am     Reply with quote

Hi PCM Programmer and FvM

Thank you for your replies- they have been most helpful.

I am currently using the PIC18F2550 with 10bit A/D.

I see that the PIC18F2553 is exactly pin compatible to the 2550, with 12 bit A/D. That is GREAT!

So is it just a matter of changing the code to:
#include <18F2553.H>
#device ADC=12

or are there other issues that I have to worry about when doing 12bit A/D?

Thank you
a.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Nov 05, 2008 1:56 am     Reply with quote

Quote:
So is it just a matter of changing the code to:
#device ADC=12

I don't see that option in the manual. I only see ADC=16, and the
result is left justified. You could easily add a line of code to shift
it right 4 bits to make it right justified.

You didn't post your compiler version, but the .LST file code should
be checked to make sure it's correct.
arrow



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

PostPosted: Wed Nov 05, 2008 2:03 am     Reply with quote

Hi PCM Programmer

The compiler version is 4.067.

The compiler does not complain if I put in ADC=12.
It does not complain if I put in ADC=16 either.

Is 12bit A/D as noisy as the 10bit i.e. I usually get approximately +/-1bit noise. Will the 12bit give +/-1bit or many more to match the noise of the 10bit A/D?

Thank you
a.
Ttelmah
Guest







PostPosted: Wed Nov 05, 2008 3:40 am     Reply with quote

You need to work out where most of your 'noise' is coming from.
The PIC ADC, has a huge number of different noise sources.
Largest for most people, is the Vref. Using the supply as Vref, you would be 'lucky' to get down to one bit of noise. Switching to an external Vref, and ensuring that this is stable, and well smoothed helps a lot. You gain even more, if you use Vref+, and Vref-, and connect the Vref- to the ground used for your analog circuitry. Great care is needed in design. For example, you can use a separate 'analog' ground plane, but then you potentially introduce new problems, depending on where the plains join, and how signals are routed round them. However using a separate plane for analog, is probably necessary if you have any high power circuitry involved. Then, with the analog gound connected to Vref-, and using an external Vref, use the INT_AD, and sleep. What you do, is to actually stop the processor while the ADC conversion is performed, and have it awaken automatically when the conversion is complete. Without this, the noise from the processor clocks, and any I/O being performed, probably accounts for a large part of your +/- one bit.
The minimum Vref span, increases to 3V, for the 12bit converter to give 12bit accuracies.
Unfortunately, getting a 'true' 12bit, or more of repeatable linear ADC accuracy is not as easy as some people may think. Most of the higher bit count ADC's, unless very expensive, are _audio_ ADC's, and do not give true repeatable linear bit counts. For instumentation work, you need to be using very careful analog design and component selection all the way to your ADC, and at the ADC itself. Component costs rise significantly, you may be surprised at how much noise simple components like resistors actually introduce. 12bits is still reasonably 'easy', with but even here, care is needed, and going beyond this, becomes increasingly difficult. It is quite common to see units being sold offering '16bit resolution', yet do a full analysis, and find that the real useable resoution, is only in the order of perhaps 13bits....

Best Wishes
arrow



Joined: 17 May 2005
Posts: 213

View user's profile Send private message

PostPosted: Wed Nov 05, 2008 3:51 am     Reply with quote

Hi Ttelmah

Thank you for your thorough reply. I will get the relevant PIC chips and start working on the 12 bit A/D.

I appreciate your help
a.
Guest








PostPosted: Tue Mar 24, 2009 6:10 pm     Reply with quote

So does CCS support the ADC=12 or do you have to use the ADC=16?
Also when setting up the Vref+ and Vref- do you connect the pins to vcc and vss respectfully or do you also have to setup in software?
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Mar 25, 2009 12:26 am     Reply with quote

If the manual or the device file comments don't make it clear, check the register settings and data processing in the list file. Everything is at your fingertips.
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