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
    25.9 KB · Views: 2,098
  • Pump Controller - Test.asm
    6 KB · Views: 296
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.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…