Serial Wombat
a general-purpose digital interface device for hobbyists, engineers and students

 


Home
Overview
Protocol
Documentation
Channel Modes
Direct Control
Controlled Pin
Raw A/D
A/D Averaging
A/D 1st Order Filtering
Matrix Keypad
Servo Control
Analog Direct
Analog Follow
Rotary Encoder
Debouncing
Counter
Hysteresis
Morse Code
Pulse
Unipolar Stepper
LCD Driver 1
LCD Driver 2
HW Pulse Meas.
2D Lookup
SPI Master
HD44780 Generic
Remote Control
DataLogger
Min-Max
Public Data
Timed IO
Getting Started
Connectivity
Pin Mode SDK Beta
Sample Projects
Downloads
Contact Us
Purchase
Forum

Did you know...

 

Serial Wombat Transition Counter Mode

The 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:

Data Sent to the Wombat: 200 Pin # 13 Debounce frames MSB Debounce frames LSB Transition type: Maximum MSB Maximum LSB
Meaning: Configure Pin First message Pin Number to be set to Counter Counter A transition must differ from the current state for this many frames in order to be detected 0: Count Low to High Transitions
1: Count High to low Transitions
2: Count both transitions.

Add 16 (0x10) to the value if the counter should NOT roll over after maximum.

The maximum value the counter can attain. Depending on the value of byte 5, the counter will either stop at this value, or roll over to zero.
This message is echoed back by the Wombat.

 

 

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.