The ????? thing stopped again last night
Hi,
Thanks MartinM57 and Dippy for the comments, I will take them on board and do a rewrite and post it to see what you think. I did try to go through all the possibilities in the simulator before I programmed. This generator lives on a small bush block we have up in the mountains and at this time of year it gets pretty cold. Also the diesel generator is a bit noisy so I built a concrete enclosure about 30M away from our hut. My plan is to be able to hop up in the morning and be able to start the generator without freezing to death.
The idea is for the auto start to stay in the MAIN loop until the start switch is grounded (pin 2), If the start switch is grounded then the program is supposed to check for no oil pressure (pin 3), and no voltage from the generator (pin 0). If all these requirements are met then we can presume that the generator is really shutdown, and the program moves into the start routine, I flash a led (and will sound a buzzer) to alert for a start and then tries for start after once more confirming that the generator is really shutdown. Firstly I turn on the fuel solenoid (fuel), then I turn on the starter for 1 second (starter), then I pause for 5 seconds for it to cough and splutter and settle down, Next I turn on the contactor, after which I check for voltage from the generator through the sense (pin 0), if the program decides that there is no voltage from the generator it turns off the contactor the fuel, and just to be safe, the starter. It then pauses for another 5 seconds for the generator to stop in case it was running, checks for voltage once again and if there is no voltage tries for a start two more times..... If it fails to start on the third occasion it goes into the alarm routine until I go over and see why not and reset the program. Presuming a start the program then moves between the "MAIN" procedure and the "RUNCHECK" If the "fuellevel" pin goes to ground the idea is that the INLED flashes inside the hut so I know to put some fuel in the generator, If the "oilpress" pin goes to ground then I want an alarm shutdown and the INLED flashes at a different frequency inside the hut. If the "startsw" goes high I want a shutdown and for the program to back to the MAIN loop
However the program stopped last night after running all day yesterday and last night till I checked it at about 4.00am, so now I am back to thinking it's a heat related issue which is where I started with this problem a week ago, At 4.00 am I reset the circuit and it's still going.
I just went outside now and tested the battery ant it's at 12.9V then I disconnected the oil pressure switch and it went into shutdown mode as it does when I do a simulation.
Now when I think about it when I had MPep's program running I had the circuit sitting on the office bench beside me in the warm house not outside below freezing.
The frustrating thing is that I originally presumed I had a dry joint so I checked my soldering, then I presumed I had a heat sensitive component, so I replaced what I could, then I thought maybe a faulty picaxe, so I ordered a couple more and rebuilt the circuit completely on a fresh Kiwi Patch Board.
Tonight I might just program in a simple flashing led routine and see what happens,
Lucky I like a challenge
Regards and thanks
Tony