Question: The VHDL code I sent measures the distance using HCSR 0 4 and displays it on the BASYS 3 screen. I want this code to
The VHDL code I sent measures the distance using HCSR and displays it on the BASYS screen. I want this code to add certain numbers between certain distances and display them on the seven segment display. For example, between and cm add to the amount, and between and cm add so when it detects between and cm for times total amount should be In the following code, sw represents the distance which attendet to number.
library IEEE;
use IEEE.STDLOGICALL;
use IEEE.stdlogicunsigned.all;
use ieee.NUMERICSTDall;
Uncomment the following library declaration if using
arithmetic functions with Signed or Unsigned values
use IEEE.NUMERICSTDALL;
Uncomment the following library declaration if instantiating
any Xilinx leaf cells in this code.
library UNISIM;
use UNISIM.VComponents.all;
entity decimal is
Port sw : in stdlogicvector downto ;
reset : in stdlogic;
clk : in stdlogic;
an : out stdlogicvector downto ;
led : out stdlogicvector downto ;
end decimal;
architecture Behavioral of decimal is
signal LEDBCD : integer;
signal refreshcounter : stdlogicvector downto ;
signal LEDactivatingcounter : stdlogicvector downto ;
signal wwww : integer;
signal number : integer;
signal amount : integer;
begin
process number
begin
number TOINTEGERunsignedsw;
amount ;
if number and number then
amount amount ;
elsif number and number then
amount amount ;
else
amount amount;
end if;
end process;
w amount ;
wamount mod ;
wamount mod ;
wamount mod ;
processLEDBCD
begin
case LEDBCD is
when led ;
when led ;
when led ;
when led ;
when led ;
when led ;
when led ;
when led ;
when led ;
when led ;
when others led ;
end case;
end process;
processclkreset
begin
if reset then
refreshcounter others ;
elsif risingedgeclk then
refreshcounter refreshcounter ;
end if;
end process;
LEDactivatingcounter refreshcounter downto ;
processLEDactivatingcounter
begin
case LEDactivatingcounter is
when
an ;
LEDBCD w;
when
an ;
LEDBCD w;
when
an ;
LEDBCD w;
when
an ;
LEDBCD w;
end case;
end process;
end Behavioral;
The code is not working properly, can you fix it
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
