Good morning to all dear friends, for those who have not followed my
past problems, I have been asked to design a system that drives a DC
motor with encoder (I will attach the text of the project). In all this
time I managed to create a PWM, a PI regulator and recently I designed a
system that counted the time elapsed between 2 pulses of channel A of
the encoder to obtain the motor speed (which turned out to be a failure
according to my professor because I wasn't taking into account the speed
reducer installed on the DC motor). He advised me to use a reciprocal
counter[(?) never heard of it] or if I have anything else in mind I'm
free to do so. To tell the truth, I find myself once again in the dark
tunnel of VHDL and I have no idea how to proceed and for this reason I
ask for your opinion on how to calculate the speed of this quadrature
encoder. A second problem I encountered is that of real numbers: taking
the PI regulator as an example, when I calculate I, the product with the
sampling period gives me a very small value that VHDL truncates to 0,
how do I solve this problem? The professor told me that I have to use
the 1.n representation, but he never explained how to implement it or
anything close to it.
I am truly desperate and unmotivated, I hope your words can lift me up,
I thank you infinitely in advance.
mia pi: is my pi.
mia pwm: is my pwm.
mio rilevatore: is my detector.
i'm sorry about the comments in italian language, if needed i'll proceed
to translate them all.
project text link:https://www.celec.org/doku/doku.php?id=dafare (just
for the images, if needed)
Translated project text:Suppose you have available (they will be
provided by the teacher) a DC motor equipped with a gearbox and a
quadrature digital encoder and a full bridge driver to power the moder.
A digital system must be designed capable of maintaining constant the
rotation speed of the motor which is supposed to be encoded on an 8-bit
integer in two's complement notation.
The output of the digital system consists of the digital signals
necessary for driving the bridge, i.e. a bit to indicate the direction
of rotation and a PWM signal with the duty cycle proportional to the
power to be sent to the motor.
The system must continuously monitor the quadrature encoder output to
estimate the direction and magnitude of the rotational speed. Based on
the estimated value and the reference input, the duty cycle of the
output PWM signal must be modified in order to reach the set rotation
Once the design of the digital system has been completed and its correct
behavior has been verified through MODELSIM simulation, this must be
integrated as part of a peripheral for NIOSII with the preparation of
the control commands on serial line following the system on chip model
developed in class.
The characteristics of the motor with encoder and the full bridge driver
available are summarized in the figures.
For now just ignore the nios2 part