home bbs files messages ]

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 924 of 2,576   
   Curbie to muratlanne@gmail.com   
   Re: 1kW $50 E-Cat ?   
   30 Jan 12 13:43:16   
   
   From: jim.richards65@yahoo.com   
      
   Jim,   
      
   My loops are all under 1ms including responses, just waiting for   
   button de-bouncing takes 20ms or 20 loops that can be doing something   
   else, I have no delay() functions, just a bunch of timer variables   
   that basically say, is it time to do the next step.   
      
   Again, this type a command/response loop only works if the input of   
   one command is not dependant on the results of another, in which case,   
   you need a run-queue.   
      
   Some character spinner stuff if it's helpful.   
      
   Curbie   
      
   byte pumpF =                   N_OFF;               // last feed pump   
   character   
   char spinner[] = {'X','|', '/', '-', '\'};            // sequence   
   through these chars to make a spinner   
     lcd.write( spinner[pumpF] );                      // write spinner   
   character to line 2 to lcd   
     pumpF = bump(pumpF);                              // if feed pump   
   running, bump display character index   
      
   byte bump( byte charIndex ) {                       // bump moving   
   character index if spinner or wave is turned on   
      
   if ( charIndex == 4 ) {                             // if last display   
   character index   
     return 1; }                                       // return to   
   caller, index first display character   
   else {                                              // if displaying   
   in Fahrenheit   
     if ( charIndex == 0 ) {                           // if display off   
   character index   
       return 0; }                                     // return to   
   caller, off character index   
     else {                                            // if displaying   
   moving character   
       return charIndex + 1;                           // return to   
   caller, next character index   
     }                                                 // end if last   
   display character index   
   }                                                   // end if last   
   display character index   
   }                                                   // end bump   
   function   
   On Mon, 30 Jan 2012 15:01:21 -0500, "Jim Wilkins"   
    wrote:   
      
   >   
   >"Curbie"  wrote in message   
   >news:eapdi71gob6lvn8gae0v3lm2oqdh964aof@4ax.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   
   >   
   >>   
   >> 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......   
   >>.....   
   >   
   >I wrote essentially the same thing in QBasic using an INKEY$ procedure to   
   >read the keyboard, including the  and function keys,  and SELECT CASE   
   >to parse it, on the assumption that the program runs faster if it loops   
   >after the first TRUE match and there is only going to be one button push or   
   >keystroke detected per pass. Also I can keep the line shorter and neater   
   >when testing for multiple equivalent conditions like CASE "+", "=", plus   
   >arrow key character pairs.   
   >   
   >Compiled code in DOS ran more than fast enough but interpreted code under   
   >Windows was sometimes slow enough to see the spinning * ( | / - \ | / - \ )   
   >loop speed indicator advance.   
   >   
   >Instead of scheduling calls I set flags and state variables so I could   
   >evaluate a matrix of the changed conditions all at once after completing the   
   >loop and prioritize the responses, sort of a state machine without all the   
   >formalities. The code was easier to figure out a month later if the sensing   
   >and decision-making were grouped separately.   
   >   
   >I'll probably leave the Arduino connected to a laptop for input, file   
   >storage and display. I have a Dell D610 downstairs running days-long tests   
   >on a failing 2T hard drive. The KAWez says they cost $0.15 a day.   
   >   
   >jsw   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca