xilinx1001
Member level 3
- Joined
- Apr 3, 2013
- Messages
- 60
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,781
Hi,
I am working on nexys2 board 7 segment display
I need to display the binary value of first 4 switches on one 7 segment display
And binary value of next 4 switches on another 7 segment display
I wrote a code for this
But I have some errors in the implementation
Any help is appreciated
Errors:
ERROR:HDLParsers:164 - "C:/Users/Vivek Alaparthi/Desktop/Xilinx projects/display2/display.vhd" Line 44. parse error, unexpected THEN, expecting SEMICOLON
ERROR:HDLParsers:808 - "C:/Users/Vivek Alaparthi/Desktop/Xilinx projects/display2/display.vhd" Line 48. = can not have such operands in this context.
ERROR:HDLParsers:808 - "C:/Users/Vivek Alaparthi/Desktop/Xilinx projects/display2/display.vhd" Line 54. = can not have such operands in this context.
ERROR:HDLParsers:808 - "C:/Users/Vivek Alaparthi/Desktop/Xilinx projects/display2/display.vhd" Line 60. = can not have such operands in this context.
I am working on nexys2 board 7 segment display
I need to display the binary value of first 4 switches on one 7 segment display
And binary value of next 4 switches on another 7 segment display
I wrote a code for this
But I have some errors in the implementation
Any help is appreciated
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity main is
port(
clock : in STD_LOGIC;
sevenseg : out STD_LOGIC_VECTOR(6 downto 0);
anodes : out STD_LOGIC_VECTOR(3 downto 0);
switches : in STD_LOGIC_VECTOR(6 downto 0)
--dp : in STD_LOGIC
);
end main;
architecture Behavioral of main is
signal counter: STD_LOGIC_VECTOR(1 downto 0) := (others => '0');
signal r_anodes: STD_LOGIC_VECTOR(3 downto 0);
begin
anodes <= r_anodes;
-- Given Binary Value print it
multiplex: process(counter,switches)
begin
-- Set anode correctly
case counter(1 downto 0) is
when "00" => r_anodes <= "1110"; -- AN 0
when "01" => r_anodes <= "1101"; -- AN 1
when "10" => r_anodes <= "1011"; -- AN 2
when "11" => r_anodes <= "0111"; -- AN 3
when others => r_anodes <= "1111"; -- nothing
end case;
-- -- Set segments correctly
case r_anodes is
when "1110" =>
if switches(3 downto 0) = x"0" then
sevenseg <= "1111001"; -- 1
else switches(3 downto 0) = x"1" then
sevenseg <= "1000000"; -- 0
end if;
when "1101" =>
if switches(3 downto 0) = '1' then
sevenseg <= "1111001"; -- 1
else
sevenseg <= "1000000"; -- 0
end if;
when "1011" =>
if switches(3 downto 0) = '1' then
sevenseg <= "1111001"; -- 1
else
sevenseg <= "1000000"; -- 0
end if;
when "0111" =>
if switches(3 downto 0) = '1' then
sevenseg <= "1111001"; -- 1
else
sevenseg <= "1000000"; -- 0
end if;
when others => sevenseg <= "1111111"; -- nothing
end case;
end process;
countClock: process(clock, counter)
begin
if rising_edge(clock) then
-- Iterate
counter <= counter + 1;
end if;
end process;
end Behavioral;
Errors:
ERROR:HDLParsers:164 - "C:/Users/Vivek Alaparthi/Desktop/Xilinx projects/display2/display.vhd" Line 44. parse error, unexpected THEN, expecting SEMICOLON
ERROR:HDLParsers:808 - "C:/Users/Vivek Alaparthi/Desktop/Xilinx projects/display2/display.vhd" Line 48. = can not have such operands in this context.
ERROR:HDLParsers:808 - "C:/Users/Vivek Alaparthi/Desktop/Xilinx projects/display2/display.vhd" Line 54. = can not have such operands in this context.
ERROR:HDLParsers:808 - "C:/Users/Vivek Alaparthi/Desktop/Xilinx projects/display2/display.vhd" Line 60. = can not have such operands in this context.