Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.energy.homepower    |    Electrical part of living of the grid    |    2,576 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 921 of 2,576    |
|    Curbie to muratlanne@gmail.com    |
|    Re: 1kW $50 E-Cat ? (1/2)    |
|    30 Jan 12 11:47:10    |
   
   From: jim.richards65@yahoo.com   
      
   Jim,   
      
   If the required response time is < 1ms, just poll (no interrupt), the   
   real issue is whether the commands must run in a particular order, in   
   which case you'll need a run-queue, if not just use a command and   
   response loop like below.   
      
   Also, if your timed events are not more than ~50 days apart, the   
   milliSec() function below handles timing register restarts.   
      
   If you need, LCD displays, buttons, or DS1820 perature sensors, let me   
   know, I have software for all that.   
      
   Curbie   
      
   /* This is the command and response loop that drives the controller   
   operation which runs over and over   
    again as long as the Arduino has power. This loop checks command   
   flags set and cleared by the   
    software and runs responses to the set commands while skipping   
   responses for commands not set.   
      
    The most important command which always must be checked no matter   
   what else the controller is doing,   
    is the scram command that insures that the still is not   
   over-heating and shuts the still down and   
    cools it, if it is.   
      
    This loop also sets, checks, and coordinates timing for time   
   sensitive hardware like buttons, LCD   
    display, and temperature sensors. */   
   void loop() { // the loop()   
   method   
   int button; // temporary   
   button value   
      
   button = getButton(); // get value of   
   button currently being pressed   
   if ( button != BV_NONE ) lastButton = button; // if button   
   pressed, save its value   
   readTemperatureSensors(); // if all   
   temperature sensors are not found, isolate failed sensor   
      
   if ( menuCmd ) menuRes(); // if check for   
   menu button pressed command, run response   
   if ( selectCmd ) selectRes(); // if check for   
   select button pressed command, run response   
   if ( upCmd ) upRes(); // if check for up   
   button pressed command, run response   
   if ( downCmd ) downRes(); // if check for   
   down button pressed command, run response   
   if ( rightCmd ) rightRes(); // if check for   
   right button pressed command, run response   
   if ( leftCmd ) leftRes(); // if check for   
   left button pressed command, run response   
   if ( fillCmd ) fillRes(); // if check for   
   end of fill water phase command, run response   
   if ( purgeCmd ) purgeRes(); // if check for   
   end of purge air phase command, run response   
   if ( startCmd ) startRes(); // if check for   
   end of starting phase command, run response   
   if ( adjustCmd ) adjustRes(); // if check for   
   end of adjust reflux phase command, run response   
   if ( scramCmd ) scramRes(); // if check for   
   scram phase command, run response   
   if ( scramStopCmd ) scramStopRes(); // if check for   
   end of scram stop phase command, run response   
   if ( scramTimeCmd ) scramTimeRes(); // if check for   
   end of scram stop phase command, run response   
   if ( coolCmd ) coolRes(); // if check for   
   end of cooling phase command, run response   
   if ( alertCmd ) alertRes(); // if check for   
   end of alert command, run response   
   if ( ddCmd ) ddRes(); // if display   
   dashboard command, run response   
   } // end loop   
   function   
      
   unsigned long milliSec(unsigned long startTime) { // return elapsed   
   time from the given "startTime" in mlliseconds   
   unsigned long timeInterval; // time between   
   last read and now   
   unsigned long curTime; // current time   
   const unsigned long MAX_TIME = 0xFFFFFFFF; // full 32 bit   
   value for correcting timer restart (timer value restarts happen every   
   ~50 days of continous use)   
      
   curTime = millis(); // get current   
   time   
      
   if (curTime < startTime) { // if timer   
   restart has occurred, account for the restart   
    timeInterval = curTime + (MAX_TIME - startTime) + 1L; }   
   else { // if timer   
   restart has NOT occurred   
    timeInterval = curTime - startTime; // calculate   
   interval from last time temperature sensors read   
   } // end if timer   
   restart has occurred, account for the restart   
   return timeInterval; // return to   
   caller the number of milliseconds elapsed time from the given   
   "startTime"   
   } // end MilliSec   
   function   
   On Mon, 30 Jan 2012 08:26:50 -0500, "Jim Wilkins"   
   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca