Stepper-Motor-Control  v3.0.0
System on a Chip 2014 - Group 04
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
motor_control_unit Entity Reference

Motor Control Unit. More...

Collaboration diagram for motor_control_unit:
Collaboration graph

Libraries

ieee 
 Use Standard Library.

Use Clauses

std_logic_1164 
 Use Logic Elements.

Generics

divider  integer := 125000
 Prescaler for PWM-signal.

Ports

clock   in STD_LOGIC
 component clock
reset_n   in STD_LOGIC
 resets the component
run   in STD_LOGIC
 chip enable
direction   in STD_LOGIC
 motor direction ('0' is left)
mode   in STD_LOGIC_VECTOR ( 3 DOWNTO0 )
 mode to run motor with
speed   in STD_LOGIC_VECTOR ( 2 DOWNTO0 )
 speed to run moter with
motor_pwm   out STD_LOGIC_VECTOR ( 3 DOWNTO0 )
 signal-bus for the motor pulse-width-modulation
motor_en   out STD_LOGIC_VECTOR ( 1 DOWNTO0 )
 both enable signals for the motor
steps   out STD_LOGIC_VECTOR ( 31 DOWNTO0 )
 number of steps motor did
ir   out STD_LOGIC
 IR signal set when motor stopped.

Detailed Description

Motor Control Unit.

Definition at line 44 of file motor_control_unit.vhd.

Member Data Documentation

divider integer := 125000
Generic

Prescaler for PWM-signal.

For this purpose 2,5 ms are used as minimal pulse-width.

The prescaler is calculated with the given and desired frequency via the following formula:

\begin{equation*} \text{prescaler} = \frac{f_{\text{clock}} \text{Hz}}{f_{\text{prescaler}} \text{Hz}} \end{equation*}

e.g.:

\begin{equation*} \left.\begin{aligned} f_{\text{prescaler}} &= \frac{5}{2}\,\text{ms} \newline &= 400\,\text{Hz} \newline\newline \text{prescaler} &= \frac{50\,\text{Mhz}}{400\,\text{Hz}} \newline &= 125000 \newline \end{aligned} \right\} \qquad \text{pulse-width: 2.5 ms} \end{equation*}

For simulation-purpose the divider was set to 125 for faster wave generation.

Definition at line 67 of file motor_control_unit.vhd.


The documentation for this class was generated from the following file: