|
||||||||||||||||||||||||||||||
| Did you know...
|
Serial Wombat Transition Counter ModeThe Serial Wombat can count transitions on a pin. It can increment a counter on low-to-high, high-to-low, or both transitions. Software debouncing is optional to quiet down noisy sources like mechanical switches. The user can configure a maximum value, and if the counter rolls over to zero, or stays at maximum. The count is put in the pin's public data buffer. This mode is useful for a variety of things, such as counting the number of button presses by a user. By allowing the Wombat to keep count, the host doesn't have to constantly poll the state of the pin. Note that transitions which occur faster than the frame frequency may be missed. Faster pulse counts for measurement of very fast events can be acheived with the hardware pulse measurement mode on capable pins. Message format:
Example:Pin 37 is tied to ground through a push-button switch. Internal pull-up resistors are enabled. When the button is pressed, it will transition from high to low. Configure channel 37 to count button presses. Require the switch to maintain a value for 30 frames (assume 1ms per frame) to debounce this value. Allow a maximum value of 65535, and stop rollover. 200 37 13 0x001E 0x111 0xFFFF ; Set pin 37 to counter mode,
; 30 frame debounce (0x01E)
; High to Low transitions, no rollover (0x11)
; Maximum of 65535
|
|||||||||||||||||||||||||||||
Copyright Wombat Interface Products, 2005-2008. All Rights Reserved.