We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I have a delay function that for some reason every time I included in my project it causes the micro controller to use extra power. With out the function I read 20 micro amps in total power down mode, but with the function I read 4.4 miliamps in the same mode. I use this delay function to energize a relay for about 50 miliseconds. Is there any other method I could use to replace this function with? Or even better, why is this function "I assume" causing the micro to concume so much power. Thanks. void delay (int x) small reentrant { //0 to 4,294,967,295 int i; for (i = 0; i < x; i++) { ; } }
"I use this delay function to energize a relay for about 50 miliseconds." Are you sure it's the micro and not the relay that's taking the current?!
Andy Neil, I just think it is the function, because with out this function being called in the micro, I get a reading of 20 micro amps. Also, I check the specs of the relay's coil current and that is 66.7 mili amps. The relay's coil is energized for about 50 or 80 mili seconds at most and then it is brought back to zero. This energizing process is happenning every 5 minutes. Also, when I take the micro controller out of the circuit, the current read is zero 0. So I think is the micro. What do you think? Thanks for your reponse by the way.