I'm writing some VHDL so I can interface a character LCD with my FPGA.
It goes as follows:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity Parallel_Interface_Main is
port(
Clock : in std_logic;
Read_Write : out std_logic;
Register_Select: out std_logic;
Enable : out std_logic;
Busy : buffer std_logic;
Data_In : buffer std_logic_vector(7 downto 0);
Data_Line : buffer std_logic_vector(7 downto 0)
);
end Parallel_Interface_Main;
architecture ParallelBehaviour of Parallel_Interface_Main is
signal initialized: std_logic := '0';
begin
Enable <= Clock;
initialize: process(Clock)
begin
if(Clock'event and Clock = '1') then
Register_Select <= '0';
Read_Write <= '1';
Busy <= Data_Line(7);
if(Busy = '0' and initialized = '0') then
Register_Select <= '0';
Read_Write <= '0';
case Data_Line is
when "UUUUUUUU" =>
Data_Line <= "00111100";
when "00111100" =>
Data_Line <= "00001110";
when "00001110" =>
Data_Line <= "00000110";
when "00000110" =>
Data_Line <= "00000001";
initialized <= '1';
when others =>
Data_Line <= "ZZZZZZZZ";
end case;
end if;
if(Busy = '0' and initialized = '1') then
Register_Select <= '1';
Read_Write <= '0';
case Data_In is
when "UUUUUUUU" =>
Data_In <= "01010010";
when "01010001" =>
Data_In <= "01010000";
when others =>
Data_In <= "ZZZZZZZZ";
end case;
Data_Line <= Data_In;
end if;
end if;
end process;
end ParallelBehaviour;
Basically, the LCD sends back a busy flag when it is processing an instruction, so I wrote my code to only execute when the busy flag is 0. Since I don't have the LCD hooked up to my FPGA yet, to test this code I mapped the busy signal to a push button on the board with the least significant 4 bits of "Data Line" mapped to a couple of LEDs, just so I could see if the board was cycling through the eight bit codes.
Now when I upload the programming files to the FPGA and press the push button mapped to "Busy," there is no change in the state of the Data_Line bits. Is this a result of faulty VHDL? Or is it the fact that I mapped Busy to a pushbutton while the FPGA is clocked at 125 MHz. I am not experienced enough with FPGAs to know exactly what is going on.
I'm using an Altera Arria V GX FPGA.
Data_In
is a Buffer port : it is either very poorly named, or it is supposed to be an In port... – user_1818839