Daniel Bernard ECE 1315 Digital System Design Lab #10: FSM

advertisement
Daniel Bernard
ECE 1315 Digital System Design
Lab #10: FSM Design and Interface with Stepper Motor
12/07/2010
Page 1
Lab #10: FSM Design and Interface with Stepper Motor
The purpose of this investigation was to design and implement a Finite State Machine
that controls a bi-directional stepper motor. There are three given input variables, 𝑥, 𝑦, and 𝑐𝑙𝑜𝑐𝑘.
The controller should have four output variables, 𝑧3 , 𝑧2 , 𝑧1 , and 𝑧0 , one for each wire of the
stepper motor. The inputs should give the function specified below based on their value.
𝑥 = {0, Motor stopped (controller disabled); 1, Motor active}
𝑦 = {0, Motor turns Clockwise; 1, Motor turns CC}
𝑐𝑙𝑜𝑐𝑘: (.5 second pulses)
The operation can be shown by the pulses through the system summarized in Table 1.
Table 1: Output patterns required for forward and reverse rotation
𝑦 = 0, Forward Operation:
𝑦 = 1, Reverse Operation
𝑧3 , 𝑧2 , 𝑧1 , 𝑧0
𝑧3 , 𝑧2 , 𝑧1 , 𝑧0
1 0 0 0
0 0 0 1
0 1 0 0
0 0 1 0
0 0 1 0
0 1 0 0
0 0 0 1
1 0 0 0
Repeat
Repeat
The required states can be summarized in a simpler format, since there is only one high
signal in each state, such that there are only two required input variables. In order to create the
circuit in such a way that it would reverse if 𝑦 = 1, we need to have the inputs to the first FF
based upon 𝑦 𝑥𝑜𝑟 [𝑖𝑛𝑝𝑢𝑡]. Table 2 shows the conversion from 𝑧3 , 𝑧2 , 𝑧1 , 𝑧0 to 𝑄1 , 𝑄0 .
Table 2: Conversion Table
Previous
New
𝑧3
𝑧2
𝑧1
𝑧0
𝑄1
𝑄0
1
0
0
0
0
0
0
1
0
0
0
1
0
0
1
0
1
0
0
0
0
1
1
1
Diagram 1 shows the states given. Table 3 shows the State Transition Table, and Table 4
is the State Assign table, and shows the previous and next states for both JK flip-flops.
Diagram 1: State Diagram
y=0
y=0
A
y=0
D
C
B
y=1
y=0
y=1
y=1
y=1
Page 2
Table 3:State Transition Table
Previous
Next State
State
𝑦=0 𝑦=1
A
B
D
B
C
A
C
D
B
D
A
C
𝑧3
0
0
0
1
Output 𝑦 = 0
𝑧2
𝑧1
𝑧0
1
0
0
0
1
0
0
0
1
0
0
0
Table 4: State Assign Table
𝑧3
0
1
0
0
Output 𝑦 = 1
𝑧2
𝑧1
0
0
0
0
1
0
0
1
𝑧0
1
0
0
0
Previous State
Next State
Output
̅̅̅
̅̅̅
𝑄1
𝑄0
𝐽1
𝐽0
𝑄1
𝑄0
𝐾1
𝐾0
0
0
0
x
1
x
0
1
0
1
1
x
x
0
1
0
1
0
x
1
1
x
1
1
1
1
x
0
x
0
0
0
From Table 4, we can create four Karnaugh maps to design the circuit implementation.
Map 1: 𝐽1 Karnaugh Map
0
1
𝑄1 , 𝑄0
0
0
1
1
X
X
Map 2: ̅̅̅
𝐾1 Karnaugh Map
0
1
𝑄1 , 𝑄0
0
X
X
1
1
0
Map 3: 𝐽0 Karnaugh Map
0
1
𝑄1 , 𝑄0
0
1
X
1
1
X
Map 4: ̅̅̅
𝐾0 Karnaugh Map
0
1
𝑄1 , 𝑄0
0
X
0
1
X
0
From Map 1-4, the following functions can be extracted, and implemented in Diagram 2.
𝐽1 = 𝑄0
̅̅̅
𝐾1 = ̅̅̅
𝑄0
𝐽0 = 1
̅̅̅
𝐾0 = 0
Page 3
Diagram 2: Circuit Implementation
With the given circuit diagram, we were able to attach the outputs of 𝑧3 , 𝑧2 , 𝑧1 , 𝑧0 to the
control of the stepper motor. Given such, we were able to make the motor switch direction based
upon the input of 𝑦, and have it continuously go in the desired direction.
Page 4
Download