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.

PIC12F675 ADC problem

Status
Not open for further replies.

Chrisbes

New Member
I am trying to construct a simple pump controller where the delay time and the pumping time are set on pots. This is the first time I have used analogue inputs on a PIC so I am very new to this. The schematic and the ASM code are attached.

The problem I am encountering is that the delay pot, connected to AN0 in this case, appears to affect the ADC reading from the pumping time pot connected to AN1. If, for example, AN0 is set for minimum time and AN1 set to maximum, the reading for AN1 is reduced by around half. If both are set at maximum everything works fine. Setting AN1 to minimum does not affect the reading of AN0 at all.

I am clearly doing something wrong and I have looked at it for days without finding an answer that works. I would very much appreciate some help.

Chris
 

Attachments

  • PIC12F675 Griffon Pump Controller.gif
    PIC12F675 Griffon Pump Controller.gif
    25.9 KB · Views: 2,094
  • Pump Controller - Test.asm
    6 KB · Views: 293
You haven't allowed enough time for the ADC hold capacitor to charge after changing channels. Try putting a short delay after you select the channel.

Code:
		movlw	b'00000001'		; Setup AD Conversion 
		movwf	ADCON0			; for AN0
		;[COLOR="Red"]Insert delay here[/COLOR]
		bsf		ADCON0,1 		; Start conversion

Mike.
 
Hi Mike,

Made the changes you suggested and tested it again and it works like a dream!

Thanks so much for your help!

Chris
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top