PDA

View Full Version : 12 bit or higher ADC on a PIC that works with PBP?



Brandon
- 11th November 2007, 06:28
Can someone list a few Pics that can do better then 10-bit ADC?
I am using 16f88 Pics now to monitor two Pots (on different pins) using the ADC command at 10-bits.
It's all great, (better then 8-bit) but I'd like something that can do 12-bit or better.

I checked all the Pic chips and I just can't tell which ones will work with PBP and have 12-bit ADCs that work. For example the Pic16f882 looks to have 12-bit ADCs but in the datasheet it only talks about 10-bit ADCs.

Thanks for any help,
Brandon

paul borgmeier
- 11th November 2007, 06:48
go here http://melabs.picbasic.com/Scripts/perl/picsearch.pl?action=adv
select 12 bits for the ADC resolution
Your answer will appear.

If you select the 16c774, make sure and read the errata. I used them years ago and they were not quite able to produce 12 bit resolution at the time ...

Brandon
- 11th November 2007, 07:03
Thanks Paul,

But I've used that utility, and one of the chips that comes up is the 16f882 as a 12-bit adc. But when I downloaded the datasheet for it, there is only mention of 10-bit ADC and 12-bit PWM.

I know there are other Pics that the search comes up with. And I guess what I am asking for is one or two Pics that people know will work at 12-bit with PBP with no problems.

Thanks again

mister_e
- 11th November 2007, 09:00
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=74

Brandon
- 11th November 2007, 10:12
Just to be really clear... I'm looking for actual Pic model numbers. Not just links to Microchips web site or big lists of chips.

Anyone ever use a Pic with 12bit ADCs with PBP?
What chip was it?
How well did it work in 12bit?

Thanks

mister_e
- 11th November 2007, 10:27
Sorry and welcome on the forum so far, but if you can't do a simple search for a part number, imagine how hard the coding will be... school work i guess?

first hit
PIC18F2423, PIC18F2523, PIC184423, PIC18F4523, datasheet : http://ww1.microchip.com/downloads/en/DeviceDoc/39755B.pdf

it worked great

Brandon
- 11th November 2007, 10:44
I was looking for some first hand knowledge on Pic chips with 12bit ADCs.

I have searched for them and its not that I haven't found any, it's that I found a lot.
But at-least one of them, the 16f882 seems unclear about the ADCs. Some searchs come back stating it has 12bit ADCs but the datasheet doesn't clearly state 12bit, infact it states 10bit.

I could buy some of the other Pic chips that claim to have 12bit ADCs but I was looking for a little advice from someone who may have used one before with PBP.

Your link to the entire Microchip website wasn't really what I was looking for.

But thanks and I hope I have not offended you.

Bruce
- 11th November 2007, 13:32
As far as I can tell the 16F882 is 10-bit. I wouldn't think the 882 had 12-bit when the rest
of the same family like 883, 884, 886 and 887 were all 10-bit.

I've used the 18F2553 and 18F2523 12-bit A/D. Here's a short code example;


'CONFIG settings in 18F2553.INC
'CONFIG PLLDIV=5,CPUDIV=OSC1_PLL2,USBDIV=2,FOSC=HS,FCMEN=O FF,IESO=OFF
'CONFIG VREGEN=OFF,CCP2MX=ON,WDT=OFF,WDTPS=32768,PBADEN=OF F,PWRT=OFF,MCLRE=OFF
'CONFIG LPT1OSC=OFF,BOR=ON,BORV=2,STVREN=ON,LVP=OFF,XINST= OFF,DEBUG=OFF,WRTB=ON

DEFINE OSC 20
DEFINE DEBUG_REG PORTC
DEFINE DEBUG_BIT 6 ' Hardware USART TX pin
DEFINE DEBUG_BAUD 9600
DEFINE DEBUG_MODE 0 ' Non-inverted mode through MAX233

ADResult VAR WORD

Q CON 3126 ' (5/4095)*256=0.312576313. rounded up to 3126

ADCON0 = %00000001 ' A/D module enabled, channel 0
ADCON1 = %00001110 ' Vref = Vdd & Vss, AN0 = analog
ADCON2 = %10101011 ' Right justified, 12 Tad, Frc clock
INTCON = %01000000 ' Global ints disabled, enable peripheral interrupts
PIE1.6=1 ' A/D interrupt enabled (for wake from sleep)

' Note we don't use an interrupt routine since the A/D complete
' interrupt is only waking the PIC from sleep.

Main:
ADCON0.1=1 ' Start the A/D conversion
@ SLEEP ' Sleep until A/D conversion finished
WHILE ADCON0.1 ' A/D complete?
WEND '
PIR1.6=0 ' Clear A/D int flag

ASM
MOVFF ADRESL,_ADResult ; get low byte
MOVFF ADRESH,_ADResult+1 ; get high byte
ENDASM

DEBUG "Raw A/D val = ",DEC ADResult,13,10
ADResult = ADResult */ Q
DEBUG "ADResult */ ",DEC Q," = ",DEC ADRESULT,13,10
DEBUG "ADResult = ",DEC ADResult DIG 4,".",DEC ADResult DIG 3,_
DEC ADResult DIG 2,DEC ADResult DIG 1,"V",13,10
PAUSE 2000
GOTO Main

END

Charles Linquis
- 11th November 2007, 17:19
I have used the new 18F8723 with 12 bit A/D.

To get the the full resolution, you have to use DEFINE

"DEFINE ADC_BITS 10"

Because PBP only "knows about" 8 and 10 bit converters.
If the DEFINE is missing or not interpreted properly in the
compiler, it will default to 8 bits.

If you use the line above at the top of your program,
and have a 12-bit converter in your chip, the result will
indeed have a full 12 bits of resolution.