### 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.

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,024
• Pump Controller - Test.asm
6 KB · Views: 226

#### Pommie

##### Well-Known Member
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
;[COLOR="Red"]Insert delay here[/COLOR]
bsf		ADCON0,1 		; Start conversion

Mike.

#### Gayan Soyza

##### Active Member
Wrong post ignore my post.

Last edited:

#### Chrisbes

##### New Member
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.

Replies
8
Views
14K
Replies
28
Views
12K
Replies
19
Views
7K
Replies
13
Views
4K
Replies
4
Views
2K