View Single Post
  #10   Spotlight this post!  
Unread 03-04-2012, 10:12
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 512
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: Toggle switch problems

Here are a couple subvi's we have made to help with these issues.

TON.vi is "Timer On delay" takes a Boolean input and delays TRUE in milli-seconds.
TOF.vi is "Timer Off delay" takes a Boolean input and delays the on to off transition by milliseconds.
TOF_Toggle.vi takes a Boolean input, TOF's signal and then toggles output state.

In PLC code, TOF is used to de-bounce signals, limit switches. Many game controllers will double trip when pressed or released, using the TOF will mask those events. We typically use 100 ms for the delays for joystick buttons.

All of these do not stall code with waits, it will take a snapshot of current time and set the future time to look for the delay, and are re-entrant mode, so many in the vi will not conflict with each other.
Attached Files
File Type: zip TORC Sub VIs.zip (26.0 KB, 19 views)
__________________
The sooner we get behind schedule, the more time we have to catch up.

Reply With Quote