[ SM3117 ] - [ Class 07 ] - Counter

Class 07 - Presentation and others - Door counter exercise

 

1

Two light sensors will be used in a sequence (S1, S2)

 

2

The state diagram for explanation

 

3

State transition table

Current state
Input
Next state
Action
0
+S1
1
-
0
+S2
5
-
1
+S2
2
-
1
-S1
0
-
2
-S1
3
-
2
-S2
1
-
3
-S2
4
-
3
+S1
2
-
4
-
0
counter++
5
+S1
6
-
5
-S2
0
-
6
-S2
7
-
6
-S1
5
-
7
-S1
8
-
7
+S2
6
-
8
-
0
counter--

 

4 One variable will be required to remember the current state.