Bypass timer on reset?

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
I developed a solar light controller / timer. What happens is the PIC monitors the voltage from the solar panel. When the panel voltage drops below a certain amount a timer is started. The light comes on when the timer expires.

The reason for this is on our previous purchased controller, it turned the light on when the voltage dropped to zero. The problem was there was still plenty plenty of ambient light, just not enough for the panel. Hence the reason for the timer.

I just realized that I have a small bug in my software. Should the power fail at night (disconnected battery), the timer will start again from zero. Not a big problem really but it would be nice to avoid it.


One thought I had would be to store the fact that the light is already on in eprom. If the PIC comes up again and it is dark and the eprom value is true then the timer does not start and the light comes on right away.

Any other ideas on how to solve this?
 

Markd77

Joined Sep 7, 2009
2,806
For the simple case you could just put in some code at the start that checks your voltage and if it's below the level, turn on. It would only get to this code when first turned on or reset.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
For the simple case you could just put in some code at the start that checks your voltage and if it's below the level, turn on. It would only get to this code when first turned on or reset.

That is a good idea. I think it would work. I already turn it off first thing. I could turn it off or on based on the input voltage.
 
Top