What chip(s) would you use if you were to do this project again? I understand the 4 bit noise... I planned on that. I am using a low tempo cap (50ppm), did you do so also? I would hope the internal current sources are not that temp-dependant! Thanks a bunch, Terry At 05:46 PM 10/21/99 +0200, you wrote: >Hej Terry A. Steen. Tack fšr ditt meddelande 11:17 1999-10-21 -0400 enligt nedan: >>Hi, new guy here... > >Welcome :) > >>I am trying to read the A/D port on a PIC14000. I am clocking at 16MHz XTAL >>(want to try 20), going for 16bits. > >16 bit true resolution is completely impossible. >I had almost 4*bit* noise before digital filter, so i was getting about 12bit real output. > >Also, it is drifting with temeprature, so it do need the calibration algorithms described in the manual. > >> I am REAL unsure of the proper way to >>use the A/D input. I have followed the steps in the manual, but just don't >>seem to be getting anywhere. Does anybody have a skeleton of a simple -- >>read AN0, so I can get this puppy rolling? >> >>Thanks! >> >>Terry > >I found this in my first and never-again PIC14000 project >think i cut-pasted it from a Micrichip demo code > > bcf STATUS,RP0 ;BANK0 > clrf ADTMRH ;clear a/d timer for 16 bits > clrf ADTMRL > bcf PIR1,OVFIF ;clear a/d timer overflow flag > bcf PIR1,ADCIF ;clear a/d capture complete flag > movlw .50 ;500uS delay for signal to settle > call delay10 > > bsf STATUS,RP0 ;BANK1 >; bsf PIE1,ADCIE ;** enable a/d capture interrupt > bsf PIE1,OVFIE ;## enable a/d timer overflow interrupt > bsf INTCON,PEIE ;enable peripheral interrupt > bcf SLPCON,OSCOFF ;leave main osc running during sleep for a/d > bcf STATUS,RP0 ;BANK0 > > bcf ADCON0,ADRST ;start conversion > > sleep ;can sleep instead of next ad_wait loop > >;ad_wait: >; LEDSINC >; btfss PIR1,ADCIF ;** wait until a/d capture >; btfss PIR1,OVFIF ;## wait until a/d timer overflows >; goto ad_wait > >ad_stop:bsf ADCON0,ADRST ;stop a/d > btfsc PIR1,ADCIF ;## check if signal is greater than full scale >; btfss PIR1,OVFIF ;** check is signal is greater than full scale > goto ad_ok > movlw 0xff ;if signal is too large, value = ffff > movwf ADCAPH > movwf ADCAPL >ad_ok: > bcf PIR1,OVFIF ;clear a/d timer overflow flag > bcf PIR1,ADCIF ;clear a/d capture complete flag > return > > >Good luck >/Morgan >Morgans Reglerteknik, HŠllekŒs, 277 35 KIVIK, SWEDEN > tel +46(0)414-446620, fax -70331, mrt@iname.com > >