Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------------------------------
- -- Company:
- -- Engineer:
- --
- -- Create Date: 15:35:13 12/07/2011
- -- Design Name:
- -- Module Name: LCD_banner - Behavioral
- -- Project Name:
- -- Target Devices:
- -- Tool versions:
- -- Description:
- --
- -- Dependencies:
- --
- -- Revision:
- -- Revision 0.01 - File Created
- -- Additional Comments:
- --
- library IEEE;
- use IEEE.STD_LOGIC_1164.ALL;
- use IEEE.STD_LOGIC_ARITH.ALL;
- use IEEE.STD_LOGIC_UNSIGNED.ALL;
- -- Uncomment the following library declaration if using
- -- arithmetic functions with Signed or Unsigned values
- --use IEEE.NUMERIC_STD.ALL;
- -- Uncomment the following library declaration if instantiating
- -- any Xilinx primitives in this code.
- --library UNISIM;
- --use UNISIM.VComponents.all;
- entity LCD_banner is
- Port ( iCLK : in STD_LOGIC;
- inRST : in STD_LOGIC;
- iREADY : in STD_LOGIC;
- oMSG : out STD_LOGIC_VECTOR (7 downto 0);
- iPREKIDACI: in STD_LOGIC_VECTOR(3 downto 0);
- oEN: out STD_LOGIC
- );
- end LCD_banner;
- architecture Behavioral of LCD_banner is
- type tSTATES is (INIT,CLEAR,WAIT_LCD,SEND_CHAR,NEXT_CHAR,WAIT_HS,WAIT_LCD2,ROTATE);
- type tMEMORIJA is array (0 TO 31) OF STD_LOGIC_VECTOR(7 downto 0);
- constant SS: STD_LOGIC_VECTOR(7 downto 0):= x"53"; --"01010011"; --x"53";
- constant e: STD_LOGIC_VECTOR(7 downto 0) := x"65"; --"01100101"; --x"65";
- constant b: STD_LOGIC_VECTOR(7 downto 0) := x"62"; --"01100010"; --x"62";
- constant a: STD_LOGIC_VECTOR(7 downto 0) := x"61"; --"01100001"; --x"61";
- constant s: STD_LOGIC_VECTOR(7 downto 0) := x"73"; --"01110011"; --x"73";
- constant t: STD_LOGIC_VECTOR(7 downto 0) := x"74"; --"01110100"; --x"74" ;
- constant i: STD_LOGIC_VECTOR(7 downto 0) := x"69"; --"01101001"; --x"69";
- constant n: STD_LOGIC_VECTOR(7 downto 0) := x"6E"; --"01101110"; --x"6E"
- constant NN: STD_LOGIC_VECTOR(7 downto 0):= x"4E"; --"01001110"; --x"4E"
- constant o: STD_LOGIC_VECTOR(7 downto 0) := x"6F"; --"01101111"; --x"6F"
- constant v: STD_LOGIC_VECTOR(7 downto 0) := x"76" ; --"01110110"; --x"76"
- constant k: STD_LOGIC_VECTOR(7 downto 0) :=x"6B" ; --"01101011"; --x"6B"
- constant rzmk: STD_LOGIC_VECTOR(7 downto 0) :=x"20"; --
- constant BRISI : STD_LOGIC_VECTOR (7 downto 0):=x"1B";
- constant sROM: tMEMORIJA :=( SS,e,b,a,s,t,i,a,n,rzmk,rzmk,rzmk,rzmk,rzmk,rzmk,rzmk,
- NN,o,v,a,k,rzmk,rzmk,rzmk,rzmk,rzmk,rzmk,rzmk,rzmk,rzmk,rzmk,rzmk);
- signal sRAM : tMEMORIJA;
- signal sINDEX : STD_LOGIC_VECTOR (4 downto 0);
- signal sSTATE : tSTATES:=INIT;
- signal sMSG : STD_LOGIC_VECTOR (7 downto 0):="00000000";
- signal sEN : STD_LOGIC:='0';
- signal sCOUNT : STD_LOGIC_VECTOR( 16 DOWNTO 0 );
- signal sPrekidaci: STD_LOGIC_VECTOR(7 downto 0);
- begin
- process (iCLK, inRST) begin
- if(inRST='0') then
- sSTATE<=INIT;
- sCOUNT<="00000000000000000";
- elsif(iCLK'event and iCLK='1') then
- case sSTATE is
- when INIT =>
- if(iREADY='1') then
- sSTATE <= CLEAR;
- else
- sSTATE<=INIT;
- end if;
- when CLEAR =>
- if (iREADY='0') then
- sSTATE <= WAIT_LCD;
- else
- sSTATE<= CLEAR;
- end if;
- when WAIT_LCD =>
- if (iREADY='1') then
- sSTATE<=SEND_CHAR;
- else
- sSTATE<=WAIT_LCD;
- end if;
- when SEND_CHAR =>
- if (iREADY='0') then
- sSTATE <= WAIT_LCD2;
- else
- sSTATE<= SEND_CHAR;
- end if;
- when WAIT_LCD2 =>
- if (iREADY='1') then
- sSTATE <= NEXT_CHAR;
- else
- sSTATE<= WAIT_LCD2;
- end if;
- when NEXT_CHAR =>
- if (sINDEX=x"1F") then --last char?
- sSTATE <= WAIT_HS;
- else
- sSTATE<= SEND_CHAR;
- end if;
- when WAIT_HS =>
- if(sCOUNT=x"16D3C") then --93500
- sSTATE<=ROTATE;
- sCOUNT<="00000000000000000";
- else
- sCOUNT<=sCOUNT+1;
- sSTATE<=WAIT_HS;
- end if;
- when ROTATE=>
- sSTATE<=CLEAR;
- -- when others =>
- -- sSTATE <= WAIT_LCD;
- end case;
- end if;
- END process;
- process (iPREKIDACI) begin
- case (iPREKIDACI) is
- when "0001"=>
- sPrekidaci<= "0011" & "0001";
- when "0010"=>
- sPrekidaci<= "0011" & "0010";
- when "0011"=>
- sPrekidaci<="0011" & "0011";
- when "0100"=>
- sPrekidaci<="0011" & "0100";
- when "0101"=>
- sPrekidaci<="0011" & "0101";
- when "0110"=>
- sPrekidaci<="0011" & "0110";
- when "0111"=>
- sPrekidaci<="0011" & "0111";
- when "1000"=>
- sPrekidaci<="0011" & "1000";
- when "1001"=>
- sPrekidaci<="0011" & "1001";
- when "1010"=>
- sPrekidaci<="0100" & "0001";
- when "1011"=>
- sPrekidaci<="0100" & "0010";
- when "1100"=>
- sPrekidaci<="0100" & "0011";
- when "1101"=>
- sPrekidaci<="0100" & "0100";
- when "1110"=>
- sPrekidaci<="0100" & "0101";
- when "1111"=>
- sPrekidaci<="0100" & "0110";
- when others =>
- sPrekidaci<="0011" & "0000";
- end case;
- end process;
- -----------------------------------------------------------
- -- ENABLE CONTROL
- process (iCLK) begin
- if (iCLK'event and iCLK='1') then
- case sSTATE is
- when CLEAR =>
- sEN <= '1';
- when SEND_CHAR =>
- sEN <='1';
- when others =>
- sEN<= '0';
- end case;
- end if;
- end process;
- -- -------------------------
- process (iCLK) begin
- if (iCLK'event and iCLK='1') then
- case sSTATE is
- when INIT =>
- sRAM <=sROM;
- sINDEX<="00000";
- when CLEAR =>
- sMSG<= BRISI;
- when SEND_CHAR =>
- sMSG<=sRAM(CONV_INTEGER(sINDEX));
- when NEXT_CHAR =>
- if (sINDEX=x"1F") then
- sINDEX <= "00000";
- else
- sINDEX <= sINDEX +1;
- end if;
- when ROTATE =>
- sRAM(0 to 31) <= sRAM(1 to 14) & sRAM (0) & sPrekidaci & sRAM (17 to 30) & sRAM(16) & rzmk ;
- when others =>
- sRAM <= sRAM;
- end case;
- end if;
- end process;
- oEN <= sEN;
- oMSG <= sMSG;
- end Behavioral;
Add Comment
Please, Sign In to add comment