| ||
PLA10: Design phase #1. FSM and external interrupts |
||
NOTE: This post lab assignment must be solved only after having completed successfully lab session Lab10 and studied P10 example because you will copy and adapt materials from it. |
Specifications: Stepper motor controller
Our aim is to design the digital control unit (stepper_controller) for the "9904 112 31004" stepping motor from Premotec shown in Fig. 1 following our microcontroller-based strategy. Nowadays stepper motors can be found in computer peripherals, machine tools, medical equipment, automotive devices, or small business machines, to name a few applications. This PLA is adapted from problem D3.2 where you will find questions and ideas (design phase #1: questions from a to h).
Clockwise (CW) and counter-clockwise (CCW) rotation can be achieved by reversing the step sequence. Inhibit (INH) is like a count disable, do not letting the motor rotate. Step or stride angle is 7.5 degree, thus 48 CLK periods are required for a full revolution. External CLK frequency is 96 Hz, and so when running it rotates at 2 revolutions per second.
The idea is to connect four port pins to the motor coils and drive them with the right sequence so that the motor inhibits or rotates clockwise or counter-clockwise accordingly to the input signals INH and CW. Four additional pins are used connected to LED to visualise the coils binary sequence.
![]() |
Fig. 1. Example of two-phase stepper motor: characteristics, connections, full wave steeping sequence and unipolar winding circuit using a power driver to energise coils. |
Project location:
C:\CSD\P10\PLA10\stepper\(files)
Specifications: 7-segment digit sequencer
We want to design a simple driver to shown a sequence of movement, clockwise and counter-clockwise, in a single 7-segment display using a PIC18F microcontroller. Fig. 1 represents the schematic diagram of the application. This PLA is adapted from problem D3.6 where you will find questions and ideas (design phase #1: questions from a to f).
The circuit components are: (1) a clock to produce a rectangular wave with a given frequency, let us take for instance 5 Hz; (2) the digital system named sequencer and (3) the 7-segment display (common cathode) with its current-limiting resistors.
UD_L = '1', clockwise; UD_L = '0', counter-clockwise
![]() ![]() |
Fig. 1. a) Block diagram of the circuit sequencer. b) Digit segments and position when idle. c) Sequence of switching LED segments for UD_L ='1' (clockwise, up counting). |
The system has to work as specified in Fig. 1c, depending on the logic levels of the synchronous input signals: UD_L (Up, active high / Down, active low) and ST (start/stop). A start pulse (ST) activates the sequence of digit rotation that never ends until another pulse ST is applied and the sequence has reached the last state.
Project location:
C:\CSD\P10\PLA10\seq\(files)
1. Specifications: Water tank controller
We want to design a water tank controller (Water_tank_controller) as an FSM using a microcontroller PIC18F4520 that can drive two pumps independently, as represented in Fig. 1.
The tank has level sensors D1, D2, and D3 attached to the wall, so that a '1' is generated when the sensor is sunk into water. The controller works as follows: when the tank is empty, below D1, both pumps work simultaneously; when the water level is above D2 pump P1 stops; when the water is above D3, meaning that the tank is full, pump P2 stops; and finally, the pumps do not switch on until the water level is again below D1.
![]() |
Fig. 1. Diagram of the water tank installation. |
In addition to controlling the water level, we also want to indicate in a LED column the current level of the water in the tank.
This PLA is adapted from problem D3.9 where you will find design ideas. Design phase #1: questions from a to j.
Project location:
C:\CSD\P10\PLA10\tank\(files)
Specifications: LED rotator
Our aim is to implement the LED rotator in Fig. 1 using a microcontroller PIC18F4520, C language and our programming style. This PLA is adapted from problem D3.3 where you will find questions and ideas (design phase #1: questions from a to f).
CE_ L = 1 (do nothing), CE_ L = 0 (run rotating)
SR_L = 0 (shift and rotate right), SR_L = 1 (shift and rotate left)
![]() |
Fig. 1. LED rotator based on microcontroller PIC18F4520. |
Project location:
C:\CSD\P10\PLA10\rotator\(files)
Most of students will solve the same design in PLA6 adapted to our microcontroler PIC18F4520. Students who solved the pattern detector will solve the 7-segment digit sequencer.
Example of individual assignments. | |||
Circuit | |||
Est. 1 | LED rotator | ||
Est. 2 | 7-segment digit sequencer | ||
Est. 3 | Stepper motor controller | ||
Est. 4 | Water tank controller | ||
Est. 5 | ··· | ||
··· | ··· |
Follow this rubric for writing reports.