>-----Original Message----- >From: llile@SALTONUSA.COM [mailto:llile@SALTONUSA.COM] > >I am a big fan of the two button up-down "slew" control for a lot of >interfaces: People understand it well, it is simple to use >and simple to implement > >I have done the parabolic control two different ways. Both are >pretty ugly, IMHO. One is wtoo complex, the other has a long >busy state where the processor is tied up. > >1st way was to have a periodic interrupt that polls the switches. Some > >Another time I did this without interrupts by reducing the >amount of time I ignored a button press, no interrupts: How about something like: void Interrupt(void) { if(button == PRESSED) { if(button_time < MAX_BUTTON_TIME) button_time++; } else { button_time = 0; } if(button_time < DEBOUNCE_TIME) inc_value = 0; else if(button_time < SLOW_INC_TIME) inc_value = SLOW_INC_VALUE; else inc_value = FAST_INC_VALUE; } You then have an automagicaly increasing value in inc_value to be used where ever it is required in your main loop. The number of increments is easily increased, and you have debouncing built in. Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= Any questions about Bookham's E-Mail service should be directed to postmaster@bookham.com. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body