We have a program we would like to have written for a PIC18F2510 as described below. I can send you the schematic and more detail if you are interested. Let me know if this is someting you might be interested in and an estimate to complete the code.
Power up – Pins 22 and 23 Low,
If Pin 14 LOW Exercise Timer ON
Set Exerciser Timer (ET) =168 Hours
Set Generator Exercise Run Time (GRT) = 20 Minutes
Set Utility Loss Timer (ULT) Pin 17 (Low = 15 seconds, Pin 17 High = 5 seconds)
Set Generator Transfer Delay (GTD) 15 seconds
Set Utility Return Timer (URT) (Pin 12 & 13 High = 15 Min., Pin 12 High & Pin 13 Low = 5 Min., Pin 12 Low & Pin 13 High = 2 minutes)
Set Generator Off Timer (GOT) (Pin 15 High & Pin 16 Low= 0 Min., Pin 15 Low & Pin 16 High =5 Min., Pin 15 and 16 high = 15 min.)
Pin 2 Input= Utility Monitor (UM) (high = utility voltage present)
Pin 3 Input = Generator Monitor(GM) (High = Generator voltage present)
Pin 12 Input = Utility Return Timer (URT) (jumper pin#1)
Pin 13 Input=Utility Return Timer (URT) (jumper Pin#3)
Pin 14 Input=Exerciser (EX) On/Off (High = Off)
Pin 15 Input=Generator Off Timer (GOT) (Jumper Pin#1)
Pin 16 Input=Generator Off Timer (GOT) (jumper Pin#3)
Pin 17 Input=Utility Loss Timer (ULT) (High=15 Seconds, Low = 5 Seconds)
Pin 21 Output Generator start/stop relay (Generator on = High)
Pin 22 Output Transfer utility/Generator (Transfer to Generator = High)
Generator Weekly Exercise Loop: If Pin 14 Low Exerciser Timer On. Exerciser Timer is 168 hours. After the delay Generator On Pin 21 High. GRT (Generator Run Timer is activated) After delay Pin 21 LOW. Activate Exerciser Timer ET minus GRT. (minus GRT so exercise timer does not drift)
Overview: Under normal conditions Pin 2 utility monitor will be low (utility voltage present) and Pin 3 Generator Monitor (GM) will be Low (No generator voltage present)
When utility voltage is lost, the Utility Loss Timer (ULT) will be set based on the state of pin 17.
After the ULT delay, the program will confirm we still have a high at Pin 2 confirming utility has not returned. If utility has returned we go back to the “Utility Monitor Loop”. After confirming utility is still absent we then output a High on Pin 21 turning on the generator.
After a 5 second delay we look at pin 3 Generator Monitor. If pin 3 is high confirming generator is on, the GTR (Generator Transfer Delay) is implemented. At the end of the delay, we output a High on pin 22 to transfer from utility position to Generator power and got to “Transfer Return Loop”
If Pin 3 is NOT high after 5-second delay we then go to the “Generator Fault Loop” where we continue to monitor the generator and utility and take action based on whichever source becomes active first.
“Transfer Return Loop” After transfer, we continue to monitor Pin 2 for Utility Voltage Return. Once utility returns and Pin 2 is low the URT (Utility Return Timer) is initiated. After the delay, we look at Pin 2 to confirm utility voltage is still present. If utility is not present we then go back to “Transfer Return Loop”. If the utility is present and Pin 2 is LOW we drop pin 22 LOW to initiate the transfer back to Utility Voltage. We then initiate GOT (Generator Off Timer) at end of delay we drop pin 21 low turning off the generator and return to the “Utility Monitor Loop”