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.

multiplexing A/Ds with PIC12F675

Status
Not open for further replies.

RGBrainbow

New Member
Hi folks,
what i have done:
try to read out two A/Ds of the PIC12F675, both A/Ds with a different setup (one left justified, one right justified)

the data sheet says on page 42: 'Note: The GO/_DONE bit should not be set in the same instruction that turns on the A/D.'

so my code was like this:
for A/D2:
Code:
clrf adcon0     ;reset A/Ds
movlw  b'10001001'   ;A/D2,right justified, on
movwf adcon0
bsf  adcon0, go__done_bit   ;start conversion
for A/D3:
Code:
clrf adcon0     ;reset A/Ds
movlw  b'00001101'   ;A/D3,left justified, on
movwf adcon0
bsf  adcon0, go__done_bit   ;start conversion


the result had nothing to to with the position of the pots connected to the A/Ds.
After placing the 'bsf adcon0, go__done_bit ;start conversion' far away (~5ms) from the A/D setup it worked well.

my question:
What is the minimum wait time between setting up an A/D and starting the conversion?
(the 5ms above are because it fits nice in the rest of the code).
And is it the same with other PICs?

regards
joachim
 
It varies GREATLY! - based on the source impedance feeding the PIC pin.

The PIC A2D incorporates a sample and hold circuit, this requires an internal capacitor to charge - it then measures the voltage on the capacitor (it's a standard A2D technique).

So when you switch between channels this capacitor has to charge (keeping on the same channel it only has to change slightly, based on any possible voltage change on that pin), so you need to allow sufficent time for it to charge - the higher the source impedance, the longer it will take. MicroChip specify a maximum source resistance of about 2.5Kohm.

If you don't know what the source impedance is, try posting your circuit!.
 
sorry, i forgot.
the potentiometers connected to GND/AD/+5V are 4k7 lin.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top