Opel_Corsa
Member level 1
I have a code for an FSM:
However it doesn't compile and gives me the following error:
Error (10028): Can't resolve multiple constant drivers for net "lcd_data[7]" at FSM.vhd(29)
Line 29 is highlighted on the code.
Any help is greatly appreciated.
Code:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
entity FSM is
port(
key : in std_logic_vector(3 downto 0); -- pushbutton switches
sw : in std_logic_vector(8 downto 0); -- slide switches
ledg : out std_logic_vector(7 downto 0); -- green LED's (you might want to use
-- this to display your current state)
lcd_rw : out std_logic; -- R/W control signal for the LCD
lcd_en : out std_logic; -- Enable control signal for the LCD
lcd_rs : out std_logic; -- Whether or not you are sending an instruction or character
lcd_on : out std_logic; -- used to turn on the LCD
lcd_blon : out std_logic; -- used to turn on the backlight
lcd_data : out std_logic_vector(7 downto 0)); -- used to send instructions or characters
end FSM ;
architecture behavioural of FSM is
type state_type is (M,o,s,t,a);
signal y : state_type;
begin
lcd_blon <= '1'; -- backlight is always on
lcd_on <= '1'; -- LCD is always on
lcd_en <= key(0); -- connect the clock to the lcd_en input
ledg(0) <= key(0); -- send the clock to a green light, to help you debug
lcd_rw <= '0'; -- always writing to the LCD
[color=red]process(key)[/color]
begin
if (key(3) = '0') then -- reset LCD
lcd_rs <= '0'; -- send instructions
lcd_data <= "00111000"; -- prepare LCD
lcd_data <= "00111000";
lcd_data <= "00001100";
lcd_data <= "00000001";
lcd_data <= "00000110";
lcd_data <= "10000000";
elsif (key(3) = '1') then
lcd_rs <= '1'; -- send characters
if (key(0)'event and key(0) = '1') then
y <= M;
case y is
when M => if (sw(0) = '0') then
y <= o;
elsif (sw(0) = '1') then
y <= a;
end if;
when o => if (sw(0) = '0') then
y <= s;
elsif (sw(0) = '1') then
y <= M;
end if;
when s => if (sw(0) = '0') then
y <= t;
elsif (sw(0) = '1') then
y <= o;
end if;
when t => if (sw(0) = '0') then
y <= a;
elsif (sw(0) = '1') then
y <= s;
end if;
when a => if (sw(0) = '0') then
y <= M;
elsif (sw(0) = '1') then
y <= t;
end if;
end case;
end if;
end if;
end process;
with y select
lcd_data <= "01001101" when M, -- display M
"01101111" when o, -- display o
"01110011" when s, -- display s
"01110100" when t, -- display t
"01100001" when a; -- display a
end behavioural;
However it doesn't compile and gives me the following error:
Error (10028): Can't resolve multiple constant drivers for net "lcd_data[7]" at FSM.vhd(29)
Line 29 is highlighted on the code.
Any help is greatly appreciated.