Hi Steve
Thanks a million!
With your helpful suggestions I finally got the consumption down to .009 milliamp draw in my sleep loop. I had a few problems that I still don't understand. It is working good though but at first when I implemented you changes I was still getting .4 to .5 milliamp draw.
Here is what I did:
I am now using pin 20 to turn on the Lcd's VDD and the contrast's +5V by having it set as an output and forcing it high to turn them on, then to shut them off I did as you suggested and set the TRIS to an input for pin 20 and that works great for that part. I also did the same thing with pin 21 and connected the negative for both the Lcd and the contrast to that pin and that works great too. I'll use the same procedure for all the other external circuits later as well.
I also moved the R/W of the Lcd to RE2 and added Low PORTE.2 before my goto mainloop statement. Then just before going to sleep I shut off the VDD and the contrast's +5V and the grounds then set all the TRIS for all the Lcd pins as inputs but was still getting .4 to .5 milliamp draw on my amp meter in sleep.
I checked all the Lcd pins with a digital logic probe and found that the DB4, R/W, the Lcd's VDD and the +5V & -5V for the contrast were all high. When I disconnected DB4 then all those pins that were high went low and the milliamp draw started to fluctuating from .009 to about .107 milliamps which I was pretty excited to see!
In my sleep loop, I'm monitoring a push button so I have the option of turning on the Lcd while in sleep and that's when the milliamp draw jumps to .107 but it's only there for a very few milliseconds. That's great, using a photo sensor to keep the program in the sleep loop when it's dark and using a motion detector to silence the buzzer when no one is around to hear it should make the batteries last for 6 months or so. That's great!! Would you have any suggestions on a voice chip that would good for battery operation?
The problem was, that I was getting a high on pin 27, seems that setting the TRIS works on all the other Lcd pins on PORTD except for RD4 for some reason? I tried forcing RD4 low using PORTD.4 = 0 when I shut off the Lcd and it's working great now.
Any ideas on what's happening there?
Thanks jessey
Bookmarks