90 likes | 274 Vues
Finite State Recognizer. In this project, we will use the MicroStamp to function as a Finite State Recognizer (FSR). A FSR is a type of Finite State Machine that is used to identify patterns in a stream of inputs.
E N D
Finite State Recognizer • In this project, we will use the MicroStamp to function as a Finite State Recognizer (FSR). A FSR is a type of Finite State Machine that is used to identify patterns in a stream of inputs. • One example is in data comm, where a frame or packet includes special characters – to identify the start of end of a frame, or other control purposes. The machine monitors the stream of incoming bits, and generates a signal or interrupt upon recognizing a control character. • Another classic example is a drink machine, that counts coins until the price has been reached, then allows a drink to be released.
A • Note: In a course on digital logic, the construction of a FSR is a classic lab exercise. • A FSR can be represented with a graph of states, transitions, and inputs: State Transition Input/Output 1/0
0/0 0/0 1/0 Start A D C B 1/0 0/0 1/1 0/0 1/0 FSR Example • A FSR for the pattern 1101: (non overlapping) States: A: haven’t seen anything yet B: have seen a “1” C: have seen a “11” D: have seen a “110” Note that each state has two transitions leaving it (binary). Check: 1100, 11101, 1101101
A D C B FSR Example • A FSR for the pattern 1101: (overlapping patterns) 0/0 0/0 A: haven’t seen anything yet B: have seen a “1” C: have seen a “11” D: have seen a “110” This version recognizes 1101 twice in this pattern: 1101101 1/0 Start 1/0 0/0 1/1 0/0 1/0
A D C B FSR Example • A FSR for the pattern 0110: (Overlapping patterns) 0/0 1/0 A: haven’t seen anything yet B: have seen a “0” C: have seen a “01” D: have seen a “011” This version recognizes 0110 twice in this pattern: 0110110 0/0 Start 1/0 0/0 1/0 0/1 1/0
Your next lab project • Write a program for the MicroStamp11 to recognize the sequence: 1011. Allow overlapping patterns. • Use a switch for the arriving input bit. • Use a pushbutton switch to signal the micro-controller that a new bit has arrived, that it needs to check. • When the sequence is recognized, light LED 7. • For debugging, and as a check, the current “state” of the machine will be displayed using LEDs 1&0: • 00 – A • 01 – B • 10 – C • 11 - D
Use pushbutton switch B to signal that data has arrived. You may choose to use SW0-7 for the data bit
Lab project continued • Document your project in your lab notebook. • Include a FSR diagram for 1011. • Include a initial flowchart for your first design. • Include a final flowchart of your program that works. • We will use Wed of this week, and Monday of next week for lab time. • Last class day is Wed December 11. • Final exam is: (6:30pm MW classes) • December 16, 6:30pm-8:30pm
Start Next State Input Loop Get Input Display State Subroutine High-Level Design Suggestions Push Button Pressed