Learn

0/8
0/6
0/6
0/6

Practice

Stepper Coil Sequencer

A two-phase stepper motor turns one step each time its four coil drivers move to the next pattern in a fixed four-row table. The motion controller hands you a 2-bit step index and a drive enable; you produce the coil pattern. While the enable is low, every coil is released: the motor freewheels and nothing heats up.

Interface

PortDirectionTypeDescription
stepin2-bit vectorPosition in the four-step sequence
enablein1 bitDrive enable; releases all coils when low
coilsout4-bit vectorCoil drivers: coil A on bit 3 down to coil D on bit 0

Behavior

The full-step table, while enable = '1':

stepcoilsCoils energized
001100A, B
010110B, C
100011C, D
111001D, A
  • While enable = '0', coils is "0000" for every step value, including while step keeps changing
  • When enable rises again, the pattern for the current step appears immediately

Constraints

STRUCTURE

write the table as a selected assignment driving an internal pattern signal (VHDL with/select; in SystemVerilog, the equality chain from the lesson). Gate that signal with one conditional assignment for the enable.

  • VHDL: finish the table with when others driving "0000"; a selector carrying a metavalue (a non-digit value like 'X' or 'U') should leave the coils safe. The testbench drives an "XX" step at you with the drive enabled and expects released coils.
  • No processes or always blocks
Loading editor...

Click Run to execute your code. Output will appear here.