📄 scandispled.vhd
字号:
end if; elsif (count1 > 699999999 and count1 < 750000000) then if(AN(0)='0') then AN(0) <= '1'; display <= a(15); AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= a(14); AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= a(13); AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= a(16); AN(0) <= '0'; end if; elsif (count1 > 749999999 and count1 < 800000000) then if(AN(0)='0') then AN(0) <= '1'; display <= a(16); AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= a(15); AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= a(14); AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= a(17); AN(0) <= '0'; end if; elsif (count1 > 799999999 and count1 < 850000000) then if(AN(0)='0') then AN(0) <= '1'; display <= a(17); AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= a(16); AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= a(15); AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= a(18); AN(0) <= '0'; end if; elsif (count1 > 849999999 and count1 < 900000000) then if(AN(0)='0') then AN(0) <= '1'; display <= a(18); AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= a(17); AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= a(16); AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= a(19); AN(0) <= '0'; end if; elsif (count1 > 899999999 and count1 < 950000000) then if(AN(0)='0') then AN(0) <= '1'; display <= a(19); AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= a(18); AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= a(17); AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= a(20); AN(0) <= '0'; end if; end if; --count1=950000000 end if; --ctr1 CTR <= CTR + "0000000000001"; if (CTR > "1000000000000") then CTR <= "0000000000000"; end if; end if; -- dispKB="10000000" (enter) else --- dispKB=Tab count2 <= 1; for j in 1 to 20 loop --loop s(j) <= (others =>'1'); a(j) <= (others =>'1'); end loop; AN <= "0000"; display <= "00000000"; end if; --- dispKB=ESC -- end if;--clk elsif SW0= '0' and SW1='1' and SW2='0' then HS <=HS2; VS <=VS2; dispKB2 <= dispKB; CASE dispKB2 is when "10000011" => RGB <= "001";--b when "10010000" => RGB <= "010";--G when "11000110" => RGB <= "011";--Cyan= xanh nhat when "10101111" => RGB <= "100";--R when "11001000" => RGB <= "101";--Magenta = hong nhat when "10010001" => RGB <= "110";--Y when "11000001" => RGB <= "111";--w-U when others => if (CntH >= 0)and(CntH < 91 )then RGB <= "001"; elsif (CntH >= 91)and(CntH < 182 )then --CntH >= 92: pixel white=91 RGB <= "010"; elsif (CntH >= 182)and(CntH < 274 )then --CntH >= 183: pixel white=182 RGB <= "011"; elsif (CntH >= 274)and(CntH < 366 )then --CntH >= 275: pixel white=274 RGB <= "100"; elsif (CntH >= 366)and(CntH < 458 )then RGB <= "101"; elsif (CntH >= 458)and(CntH < 550 )then RGB <= "110"; else RGB <= "111"; -- con lai la white end if; end case; if count < max THEN count <= count + 1; else count <= 0; end if; if (count<150000000) then --dieu kien cho lan dich dau tien cua dong ho if (CTR="0000000000000") then --dem quet LED, 4096 clock quet qua 1 lan if(AN(0)='0') then AN(0) <= '1'; display <= ledout3; AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= ledout4 ; AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= ledout5; AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= ledout2; AN(0) <= '0'; end if; end if; CTR<=CTR+"0000000000001"; if (CTR > "1000000000000") then CTR<="0000000000000"; end if; elsif (count>149999999 and count<200000000) then --dieu kien cho lan dich thu 2 cua dong ho if (CTR="0000000000000") then if(AN(0)='0') then AN(0) <= '1'; display <= ledout2; AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= ledout3; AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= ledout4; AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= ledout1; AN(0) <= '0'; end if; end if; --CTR CTR<=CTR+"0000000000001"; if (CTR > "1000000000000") then CTR<="0000000000000"; end if; elsif (count>199999999 and count<250000000) then--dieu kien cho lan dich thu 3 cua dong ho if (CTR="0000000000000") then if(AN(0)='0') then AN(0) <= '1'; display <= ledout1; AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= ledout2; AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= ledout3; AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= ledout0; AN(0) <= '0'; end if; end if; --CTR CTR<=CTR+"0000000000001"; if (CTR > "1000000000000") then CTR<="0000000000000"; end if; elsif (count > 249999999 and count < 300000000) then-- dieu kien cho lan dich thu 4 cua dong ho if (CTR="0000000000000") then if(AN(0)='0') then AN(0) <= '1'; display <= ledout0; AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= ledout1; AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= ledout2; AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= ledout5; AN(0) <= '0'; end if; end if; --CTR CTR<=CTR+"0000000000001"; if (CTR > "1000000000000") then CTR<="0000000000000"; end if; elsif (count>299999999 and count<350000000) then-- dieu kien cho lan dich thu 5 cua dong ho if (CTR="0000000000000") then if(AN(0)='0') then AN(0) <= '1'; display <= ledout5; AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= ledout0; AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= ledout1; AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= ledout4; AN(0) <= '0'; end if; end if; --CTR CTR<=CTR+"0000000000001"; if (CTR > "1000000000000") then CTR<="0000000000000"; end if; elsif (count>349999999 and count<400000000) then-- dieu kien cho lan dich thu 6 cua dong ho if (CTR="0000000000000") then if(AN(0)='0') then AN(0) <= '1'; display <= ledout4; AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= ledout5; AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= ledout0; AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= ledout3; AN(0) <= '0'; end if; end if; --CTR CTR<=CTR+"0000000000001"; if (CTR > "1000000000000") then CTR<="0000000000000"; end if; end if; --count =400000000 elsif SW0= '0' and SW1='1' and SW2='1' then if SW3='0' then --SW1SW2SW3=100 gio/phut if (CTR="0000000000000") then if(AN(0)='0') then AN(0) <= '1'; display <= ledout3; AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= ledout4; AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= ledout5; AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= ledout2; AN(0) <= '0'; end if; end if; --CTR CTR<=CTR+"0000000000001"; if (CTR > "1000000000000") then CTR<="0000000000000"; end if; else --Sw3=1 SW1SW2SW3=101 phut/giay if (CTR="0000000000000") then if(AN(0)='0') then AN(0) <= '1'; display<= ledout1; AN(1) <= '0'; elsif (AN(1)='0') then AN(1) <= '1'; display <= ledout2; AN(2) <= '0'; elsif (AN(2)='0') then AN(2) <= '1'; display <= ledout3; AN(3) <= '0'; elsif (AN(3)='0') then AN(3) <= '1'; display <= ledout0; AN(0) <= '0'; end if; end if; --CTR CTR<=CTR+"0000000000001"; if (CTR > "1000000000000") then CTR<="0000000000000"; end if; end if;--SW3 SW1SW2SW3=100+101 gio/phut/giay elsif SW0= '1' and SW1='0' and SW2='0' then if SW3='0' then --SW1SW2SW3=110 tu dong if (CTR="0000000000000") then if(AN(0)='0') then --hien thi hang chuc AN(0) <= '1'; display <= ledoutsp1; AN(1) <= '0'; elsif (AN(1)='0') then --hien thi sp hang tram AN(1) <= '1'; display <= ledoutsp2; AN(2) <= '0'; elsif (AN(2)='0') then --hien thi san pham hang ngan AN(2) <= '1'; display <= ledoutsp3; AN(3) <= '0'; elsif (AN(3)='0') then --hien thi hang san pham don vi AN(3) <= '1'; display <= ledoutsp0; AN(0) <= '0'; end if; end if; --CTR CTR<=CTR+"0000000000001"; if (CTR > "1000000000000") then CTR<="0000000000000"; end if; else -- SW3='1' --SW1SW2SW3=111 bang tay if (CTR="0000000000000") then if(AN(0)='0') then --hien thi hang chuc AN(0) <= '1'; display <= ledtay1; AN(1) <= '0'; elsif (AN(1)='0') then --hien thi sp hang tram AN(1) <= '1'; display <= ledtay2; AN(2) <= '0'; elsif (AN(2)='0') then --hien thi san pham hang ngan AN(2) <= '1'; display <= ledtay3; AN(3) <= '0'; elsif (AN(3)='0') then --hien thi hang san pham don vi AN(3) <= '1'; display <= ledtay0; AN(0) <= '0'; end if; end if; --CTR CTR<=CTR+"0000000000001"; if (CTR > "1000000000000") then CTR<="0000000000000"; end if; end if; -- SW3 elsif SW0= '1' and SW1='1' and SW2='1' then if (CTR="0000000000000") then if(AN(0)='0') then --hien thi hang chuc AN(0) <= '1'; display <= "10000111"; AN(1) <= '0'; elsif (AN(1)='0') then --hien thi sp hang tram AN(1) <= '1'; display <= "10010010"; AN(2) <= '0'; elsif (AN(2)='0') then --hien thi san pham hang ngan AN(2) <= '1'; display <= "10101111"; AN(3) <= '0'; elsif (AN(3)='0') then --hien thi hang san pham don vi AN(3) <= '1'; display <= "11111111"; AN(0) <= '0'; end if; end if; --CTR CTR<=CTR+"0000000000001"; if (CTR > "1000000000000") then CTR<="0000000000000"; end if; end if; -- SW0SW1SW2 end if;--clk end process;end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -