01-08-2008 04:05 AM
01-08-2008 07:08 AM
Here's a couple ideas:
1. Easier, but with non-deterministic response time: Wire the button up to one of your I/O pins and poll it. When you detect the button, issue a software call to stop the pulse train. If the duration of the button press may be short compared to your polling rate, then wire it to a counter source pin and perform edge counting. When you poll any value > 0, the press has happened. (Sometimes the value may be >1 if the switch has "bounce").
2. Trickier, but with deterministic hardware timing: Configure another counter, call it counter B, for triggered pulse generation. Wire/configure the button as the trigger. Make sure that the "high time" of the pulse is long enough to let your software respond, if needed. Also configure your original continuous pulse train counter to use Ctr B's output as a "pause trigger", specifying to pause when high. When the button is pressed, counter B will fire a pulse and that pulse will inhibit your original counter's pulse generation. In short, the pulses will stop until counter B's pulse has completed its full duration. Your software can monitor for this series of events and stop the original counter task if needed.
-Kevin P.
01-08-2008 07:26 AM
Thanks for those ideas.... I may investigate both methods...
Thanks again for your help, it is most appreciated.
Jamie