Thông báo

Collapse
No announcement yet.

hộ e điều khiển led 32x32 ạ

Collapse
X
 
  • Lọc
  • Giờ
  • Show
Clear All
new posts

  • hộ e điều khiển led 32x32 ạ

    bác nào sửa giúp a cái bộ chia tần trong đoạn code này với ạ.yêu cầu là xung chuẩn của kit 50khz dùng cho điều khiển led 32x32.nhưng e ko biết sửa.bác nào sửa giúp e với ạ.code đây ạ.tks các bác rất nhiều

    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 instantiating
    ---- any Xilinx primitives in this code.
    --library UNISIM;
    --use UNISIM.VComponents.all;

    entity led32x32 is
    Port ( clk : in STD_LOGIC;
    row : out STD_LOGIC_VECTOR (31 downto 0);
    colum : out STD_LOGIC_VECTOR (31 downto 0));
    end led32x32;

    architecture Behavioral of led32x32 is
    signal cf100: integer range 0 to 151000:=0;
    signal clk100hz : std_logic:='0';
    signal tmp_colum : std_logic_vector (31 downto 0);
    signal counter:std_logic_vector (4 downto 0);


    constant h0: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h1: std_logic_vector(31 downto 0):="01100001111100000000000000000000";
    constant h2: std_logic_vector(31 downto 0):="01010000010000000000000000000000";
    constant h3: std_logic_vector(31 downto 0):="01001000010000000000000000000000";
    constant h4: std_logic_vector(31 downto 0):="11101000010000000000000000000000";
    constant h5: std_logic_vector(31 downto 0):="01001000010000000000000000000000";
    constant h6: std_logic_vector(31 downto 0):="01010000010000000000000000000000";
    constant h7: std_logic_vector(31 downto 0):="01100000010000000000000000000000";
    constant h8: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h9: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h10: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h11: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h12: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h13: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h14: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h15: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h16: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h17: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h18: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h19: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h20: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h21: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h22: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h23: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h24: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h25: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h26: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h27: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h28: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h29: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h30: std_logic_vector(31 downto 0):="00000000000000000000000000000000";
    constant h31: std_logic_vector(31 downto 0):="00000000000000000000000000000000";



    begin
    colum<=tmp_colum;
    --Quét theo hàng , d? li?u hi?n th? dua ra trên c?t
    --------------------------------------------------------------------------------------------------------------
    --Kh?i chia t?n-- -
    --Gi? s? xung chu?n c?a kit là 10KHZ -
    --? dây ta c?n s? d?ng 1 t?n s? là 10HZ d? th?c hiên quét các hàng và t?n s? 100hz d? th?c hi?n quét các c?t -

    --B? chia t?n 100Hz
    process (clk)
    begin
    if clk='1' and clk'event then
    cf100<= cf100 + 1;
    if cf100=100 then
    cf100<=0;
    end if;

    if cf100=99 then
    clk100hz<= not clk100hz;
    end if;
    end if;
    end process;

    --B? chia t?n 10Hz

    --------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------
    --B? d?m dông b? xu?t d? li?u và hàng du?c active
    process(clk100hz)
    begin
    if clk100hz='1' and clk100hz'event then
    counter<=counter + 1;
    end if;
    end process;
    --------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------
    --Ta l?n lu?t b?t 32 hàng , m?i hàng du?c b?t trong kho?ng th?i gian 0.01s
    process (counter)
    begin
    case counter is
    when "00001" => row<="10000000000000000000000000000000";
    when "00010" => row<="01000000000000000000000000000000";
    when "00011" => row<="00100000000000000000000000000000";
    when "00100" => row<="00010000000000000000000000000000";
    when "00101" => row<="00001000000000000000000000000000";
    when "00110" => row<="00000100000000000000000000000000";
    when "00111" => row<="00000010000000000000000000000000";
    when "01000" => row<="00000001000000000000000000000000";
    when "01001" => row<="00000000100000000000000000000000";
    when "01010" => row<="00000000010000000000000000000000";
    when "01011" => row<="00000000001000000000000000000000";
    when "01100" => row<="00000000000100000000000000000000";
    when "01101" => row<="00000000000010000000000000000000";
    when "01110" => row<="00000000000001000000000000000000";
    when "01111" => row<="00000000000000100000000000000000";
    when "10000" => row<="00000000000000010000000000000000";
    when "10001" => row<="00000000000000001000000000000000";
    when "10010" => row<="00000000000000000100000000000000";
    when "10011" => row<="00000000000000000010000000000000";
    when "10100" => row<="00000000000000000001000000000000";
    when "10101" => row<="00000000000000000000100000000000";
    when "10110" => row<="00000000000000000000010000000000";
    when "10111" => row<="00000000000000000000001000000000";
    when "11000" => row<="00000000000000000000000100000000";
    when "11001" => row<="00000000000000000000000010000000";
    when "11010" => row<="00000000000000000000000001000000";
    when "11011" => row<="00000000000000000000000000100000";
    when "11100" => row<="00000000000000000000000000010000";
    when "11101" => row<="00000000000000000000000000001000";
    when "11110" => row<="00000000000000000000000000000100";
    when "11111" => row<="00000000000000000000000000000010";
    when others => row<="00000000000000000000000000000001";--cho nay ben tren quen ko co' 000000 nen de 00000 la other luon
    end case;
    end process;
    --------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------
    --Xu?t d? li?u c?n hi?n th? ra
    process (counter)
    begin
    case counter is
    when "00001" => tmp_colum<=h0;
    when "00010" => tmp_colum<=h1;
    when "00011" => tmp_colum<=h2;
    when "00100" => tmp_colum<=h3;
    when "00101" => tmp_colum<=h4;
    when "00110" => tmp_colum<=h5;
    when "00111" => tmp_colum<=h6;
    when "01000" => tmp_colum<=h7;
    when "01001" => tmp_colum<=h8;
    when "01010" => tmp_colum<=h9;
    when "01011" => tmp_colum<=h10;
    when "01100" => tmp_colum<=h11;
    when "01101" => tmp_colum<=h12;
    when "01110" => tmp_colum<=h13;
    when "01111" => tmp_colum<=h14;
    when "10000" => tmp_colum<=h15;
    when "10001" => tmp_colum<=h16;
    when "10010" => tmp_colum<=h17;
    when "10011" => tmp_colum<=h18;
    when "10100" => tmp_colum<=h19;
    when "10101" => tmp_colum<=h20;
    when "10110" => tmp_colum<=h21;
    when "10111" => tmp_colum<=h22;
    when "11000" => tmp_colum<=h23;
    when "11001" => tmp_colum<=h24;
    when "11010" => tmp_colum<=h25;
    when "11011" => tmp_colum<=h26;
    when "11100" => tmp_colum<=h27;
    when "11101" => tmp_colum<=h28;
    when "11110" => tmp_colum<=h29;
    when "11111" => tmp_colum<=h30;
    when others => tmp_colum<=h31;
    end case;
    end process;
    --------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------
    --Bây h d?n ph?n d?ch ch? cho ch? ch?y

    end Behavioral;

  • #2
    Nguyên văn bởi bangbang_007 Xem bài viết
    bác nào sửa giúp a cái bộ chia tần trong đoạn code này với ạ.yêu cầu là xung chuẩn của kit 50khz dùng cho điều khiển led 32x32.nhưng e ko biết sửa.bác nào sửa giúp e với ạ.code đây ạ.tks các bác rất nhiều


    end Behavioral;
    Tập mô phỏng, debug cho quen đi

    Comment


    • #3
      dạ vâng e đã sửa đc rồi ạ

      Comment

      Về tác giả

      Collapse

      bangbang_007 Tìm hiểu thêm về bangbang_007

      Bài viết mới nhất

      Collapse

      Đang tải...
      X