Error that i can't fix T.T

OP #7453757
Rate this post
• ▲ useful
▼ not useful

Goodmorning my dear friends, it's me again. I started to code the PI controller for my project to calculate the error between the PWM and the motor's encoder and the GHDL gives me an error that i can't fix( or better, i have no idea of how should i fix it). I'll attach the code and put the error down here:
PI.vhd:30:30: no function declarations for operator "-"
PI.vhd:36:72: no function declarations for operator "*"

what that means? what i did wrong?
thanks a lot in advantage <3

Attached files:
#7453942
Rate this post
• ▲ useful
▼ not useful

If you change the code to

1
  process(reference_signal, encoder_signal)is 
2
  begin
3
    -- Calcolo dell'errore tra velocità di riferimento e velocità effettiva
4
    error <= ref - to_integer(feed);
5

6
    -- Calcolo del termine integrativo
7
    integral_term <= integral_term + error;
8

9
    -- Calcolo del segnale di controllo
10
    pwm_output <= resize( encoder_signal + natural(Kp) * error + natural(Ki) * integral_term, pwm_output'length); -- è l'equivalenente di (7 downto 0) ma più skillato
11
  end process;

It will compile, but you need to check with a testbench if it will work.

Moderator (Company: Titel) #7454910
Rate this post
• ▲ useful
▼ not useful

Marco wrote:

If i don't need a process here, where do i need a process?

You don't need the process here because inside it are only 3 statements which are calculated without any relation to each other.

Or in other words: a concurrent statement has an implicit process with an implicit sensitivity list.

This concurrent statement here:

1
a <= b + c;

Is the very same like that chatty process:

1
process (b,c) is
2
begin
3
  a <= b + c;
4
end process;

Marco wrote:

IT COMPILES!!! but why?

Hint: look as said for the defined functions of the operators.

E.g. for the - operator there is no overloaded functions for integer-integer with a signed as a result. This would work also:

error <= to_signed(to_integer(ref) - to_integer(feed)),8);

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.