AnsweredAssumed Answered

switch + timer question

Question asked by ROB LUND on Jul 24, 2010
Latest reply on Jul 30, 2010 by ROB LUND

Hey everyone.  I’m about to start a new software project which requires a human UI with switches.

 

This particular UI will require two buttons.  Each button must capture a sense of “acceleration”, in that the longer the user presses the button, different stuff happens.

 

The MCU I was looking at, the JS16, only has one MTIM.  I’ve already allocated all the I/O pins, so I can’t dedicate any to input capture or output compare (the latter feature, I was under the impression could only be implemented by tying to an I?O pin).

 

My thought was to run a state machine for each switch.  When key #1 is pressed, it looks up the MTIM free running clock value as a reference point.  Then keep track of the TOFs to see just how long it was pressed.

 

Does that sound reasonable?  I’d rather to take advantage of the output compare, but can that feature be used internally instead of with a pin?

Outcomes