|
A State Machine Design for Binary Pattern
Recognition
by James Antonakos
Start ý The
Problem ý Enumeration ý State
Diagram Approach ý A Little Synchronous
Logic ý State Transition Table ý Let
Karnaugh Maps Find the Patterns ý A Hotshot
One-Shot ý The Real Thing ý Other
Implementations ý I Challenge Youý
ý Sources and PDF
OTHER IMPLEMENTATIONS
State machines also can be implemented
in software using a few lines of C code. You can see this in Listing
1, where states is a two-dimensional array containing the state
transition values.
|
next
= 0;
input = inputStream[0];
currentState = 0;
do
{
nextState = states[currentState][input];
.
.
.
currentState = nextState;
input = inputStream[next++];
} while(next < strlen(inputStream));
.
|
| Listing
1ýHere you can see a C code sample used to simulate state machine
operation. |
Even a combination of hardware and software
could be used, such as the BASIC Stamp. A short BASIC program could
sample two digital inputs and control an output bit to indicate an
even division.
PREVIOUS
NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ýCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |