shaolomc32
Newbie level 6
I write a simple code for changing the velocity of dc motor.
the code check the velocity and change the pwm value.
but the compilation of the program is not successful.I get an error massege and don't know the meaning.
please your answer.
here is the code and the wrong massage :
the code :
and the wrong massage is :
unknown problem in test_mashov.vhd
internal error:"width mismatch in relation operator" in eBuildBinaryOp at 1347 of file readxpr.c.
if anyone can help ,I will thank to you .
the code check the velocity and change the pwm value.
but the compilation of the program is not successful.I get an error massege and don't know the meaning.
please your answer.
here is the code and the wrong massage :
the code :
Code:
library ieee;
use ieee.std_logic_1164.all;
entity TEST_MASHOV is
port(clk,rst : in bit;
r,c : in integer range 0 to 255;
pwm_out : buffer integer range 0 to 255);
end;
architecture behave of TEST_MASHOV is
type st is (go,medida,lit_slower,big_slower,lit_faster,big_faster);
signal state :st;
--signal cc,ccc:integer range 0 to 255;
begin
--cc<=c;--(c*2)+10;
process(clk,rst)
begin
if rst='1' then state<=go;
elsif clk'event and clk = '1' then
case state is
when go => pwm_out<=100; state<=medida;
when medida => if r<c then state<=lit_slower;
elsif c>(r+15) then state <=big_slower;
elsif r>c then state<=lit_faster;
elsif r>(c+15) then state <=big_faster;
end if;
when lit_slower => if pwm_out>90 then pwm_out<=pwm_out-2; state<=medida; else state<=medida; end if;
when big_slower=> if pwm_out>90 then pwm_out<=pwm_out-10; state<=medida; else state<=medida; end if;
when lit_faster => if pwm_out<255 then pwm_out<=pwm_out+2; state<=medida; else pwm_out<=255; state<=medida; end if;
when big_faster => if pwm_out<255 then pwm_out<=pwm_out+10; state<=medida; else pwm_out<=255; state<=medida; end if;
end case;
end if;
end process;
end behave;
and the wrong massage is :
unknown problem in test_mashov.vhd
internal error:"width mismatch in relation operator" in eBuildBinaryOp at 1347 of file readxpr.c.
if anyone can help ,I will thank to you .
Last edited by a moderator: