Hi, This is my first post here....... hello everyone. I'm using a 16f877 non A micro and am trying to write efficient code for battery operation. Could anyone suggest any considerations to do this? I'm using the latest version of PBP and Micro Code Studio. The micro is consuming .7 to .8 milli-amps in a sleep loop that looks for a button press. I thought I should be able to get it down much lower. I checked the archives and read many discussions but couldn't find any help that specifically related to my code. It was helpful for some aspects but not all. I have code written that uses an ACD and PWM code to sound a buzzer, also I am using the pot command that reads a photo sensor that directs the code to go into a sleep loop when its dark.
For the ADC, I'm turning it off using ADCON1 = 7 then I set the adc pin to an output then make the output low and to turn it back on I'm using TRISA.0 = 1 to make it an input and ADCON1 = 4 to turn it back on. I'm not using the ADCin command to check my adc input. I'm not sure if this is the proper way to do this or not?
What about when using PWM and Pot commands? Is there anything I should be aware of using this code? There's something consuming current but I can't figure what it is, it could be my adc. Also, just to check for consumption I put the Micro to sleep with a "SLEEP 30 command (no loop) and the milli-amp meter fluctuates form .7 to .9 milli-amps, shouldn't the reading be steady while in sleep with no other code being read? Any help would be greatly appreciated.
Thanks jessey
Bookmarks