Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

pic micro controller 16f877 ADC

Status
Not open for further replies.

elangomlog

New Member
I find problem in selecting more than one ADC inputs to the pic 16f877 controller. in the program(C language) if one ADC input is zero the next subsequent ADC input scanned does not reach the full count 1024 (ie 10 bit ADC ) instead it reaches only 660 counts when the analog input is 4.95V which is equal to VPP(note-vref is internal & 8analog i/p selected ).If there is any solution, please let me know.
 
elangomlog said:
I find problem in selecting more than one ADC inputs to the pic 16f877 controller. in the program(C language) if one ADC input is zero the next subsequent ADC input scanned does not reach the full count 1024 (ie 10 bit ADC ) instead it reaches only 660 counts when the analog input is 4.95V which is equal to VPP(note-vref is internal & 8analog i/p selected ).If there is any solution, please let me know.

It depends greatly on the source impedance of the circuit feeding the analogue inputs. The analogue inputs have a sample and hold circuit built it, this requires an internal capacitor to charge to the incoming voltage. If the source impedance is high, this takes longer to do, so the capacitor isn't fully charged when you take your reading.

There are basically two answers, you can modify your circuit so it's fed from a low impedance, or you can simply introduce a delay when you switch analogue inputs - and give the sample and gold time to charge.

You can probably guess how I found this out :lol: and it wasn't just ONCE either!.
 
For slowly changing voltages which will be read infrequently, it may help to hang a cap on the ADC input. This has a similar effect to lowering the source impedance.
 
Are you saying that with only one channel, you can get the full range whereas selecting multiple channels results in a different output?

I agree with Nigel that you have to give the converter sufficent time to acquire the selected channel. The F877 datasheet gives an extensive discussion about it. This means that there must be a delay between channel selection and the start of A/D conversion.

I would also add that you can change channels to allow the next channel to be acquired while an A/D conversion is in progress. That is, after the "BSF ADCON0,GO" or equivalent C language instruction, you can change channels on the next instruction. Channel selection uses the same ADCON0 register and so you have to make sure not to inadvertently clear "ADCON0,GO".
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top