Thanks Melanie & Steve

When I said I wasn't using the ADCin command I should have elaborated to say that I am using the adc by setting ADCON0 = $41 then starting the conversion with ADCON0.2 = 1 instead of just using the ADCin command.

My project is a moisture meter circuit that uses two stainless steel wire sensors that are inserted into the soil of a potted house plant. I have an external CMOS circuit that outputs an analog voltage that is proportional to the wetness or dryness of the soil which is connected to the adc input pin. This moisture value is printed to the top line of a 2 X 16 Lcd, the bottom line shows an Alarm Set value that is user adjustable. When the plant is just watered then the Moisture will show a value in the upper range of 255 to the top line of the Lcd and as the plant dries out then this value will gradually decrease. When the user decides that the plant is dry enough to require a watering then he or she programme's the Alarm Set # on the bottom line of the Lcd to match the Moisture # and when the values match then the alarm sounds. Then when the plant is watered, that silences the alarm, until the next time the plant dries out again to that set value then the alarm sounds again. So this is used as a reminder as to when to water your plant. I was thinking of calling it the Water Minder. I think it would be cool to use a digital voice chip to announce when the plant needs a watering but for now the piezo buzzer works good. Would anyone know which voice chip would be a good choice for a battery operated project like this one?

I have the circuit wired so that it will operate on either the mains or batteries. The batteries +6V output is wired to the normally closed contact of a relay. The common input of the relay supplies the + voltage to the micro and everything else. A TX, when plugged into the mains turns on the relay which disconnects the batteries and then operates off the TX via a voltage regulator circuit which is connected to the normally open contacts of the relay. I am thinking of using 4 AA alkaline batteries with no voltage regulation. Would that be the best way to go?

When operating off the mains then a pin is set low on the micro to disable the auto off of the Lcd and any code related to the sleep loop mode. When operating off the batteries then a counter is used to automatically shut off the Lcd after 1 minute and then places the micro into a sleep loop that monitors a push button that turns back on the Lcd. When the sleep loop times out then a photo sensor is sampled and if it's dark enough (the user programme's what level is considered dark) then it jumps back to the sleep loop, if it is light enough then the CMOS circuit is turned on via a pic pin. Then the ADC is turned on and the ADC is sampled and if the plant is dry enough (if not then back to sleep & shut off everything again) then a miniature motion detector is turned on via another pic pin and the alarm sounds with a succession of single beeps followed by multiple beeps grouped together which lasts a total of 6 minutes. If the user didn't hear the beeps after 6 minutes then another loop is entered that monitors the motion detector for an activation & also the Lcd on push button and it just sits there waiting, when the loop times out then the photo sensor is polled again and if its dark then it jumps back to the sleep loop otherwise it just sits there waiting for someone to come around so they can be alerted.

I've been playing around with the method that I was using to turn on/off the Lcd and have it down to consuming .38 to .45 milliamps in the sleep loop and 3 milliamps when the Lcd is on, so its getting better. I thought it was my adc consuming current but now I know it was the Lcd too. Can anyone tell me what would be an expected milliamp draw or what I might be able to get it down to using the 16f877? I have my Lcd wired in a 4 bit mode to the 877 (7 pins used for the Lcd) and with 6 pushbuttons and external circuits needing pins to power them up, I think the 877 is a good choice and price ($6.79 CAD in lots of 10) as my code is up to almost 3000 words now and I want to also add directions to the Lcd that will explain all the functions of the device to the user which could easily use another 3000 words. Also can anyone tell me how to shut off the pot command if it consumes current when not being read? I am using TRISB.4 = 0 when I'm not using the pot command and then TRISB.4 = 1 just before I read it.

Thanks jessey