PLT 板


LINE

看板 PLT  RSS
利用Dip0~5 输入BCD码 然後七段显示显示结果 EX:11111 =>31 00001 =>1 00010 = 2 00011 = 3 00100 = 4 00101 = 5 00110 = 6 00111 = 7 01000 = 8 01001 = 9 01010 = 10 01011 = 11 01100 = 12 01101 = 13 01110 = 14 01111 = 15 10000 = 16 10001 = 17 10010 = 18 10011 = 19 10100 = 20 10101 = 21 10110 = 22 10111 = 23 11000 = 24 11001 = 25 11010 = 26 11011 = 27 11100 = 28 11101 = 29 11110 = 30 11111 = 31 这段程式码要怎样改加入呢 SEGMENT <= "00000" when "0000", --0 还要再用if DIP(4 downto 0) = "00000" then SEGMENT <= "00000" when "0000", --0 是这样吗 如果是的话 以下31种都是用这种方法吗 那要加在哪边呢 谢谢 对VHDL还是不太熟呀 --**************************************** --* Counter From 00 To 31 And Display * --* In Scanning Seven Segment LED * --* Filename : SEGMENT_COUNT_00_23.VHD * --**************************************** library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity SEGMENT_COUNT_00_31 is Port ( CLK : in std_logic; RESET : in std_logic; POINTER : out std_logic; ENABLE : out std_logic_vector(6 downto 1); SEGMENT : out std_logic_vector(6 downto 0)); end SEGMENT_COUNT_00_23; architecture Behavioral of SEGMENT_COUNT_00_23 is signal COUNT_24 : std_logic; signal CLEAR : std_logic; signal SCAN_CLK : std_logic; signal COUNT_CLK : std_logic; signal POSITION : std_logic_vector(6 downto 1); signal DIVIDER : std_logic_vector(24 downto 1); signal COUNT_BCD : std_logic_vector(7 downto 0); signal DECODE_BCD : std_logic_vector(3 downto 0); begin --*************************** --* Time Base Generation * --*************************** process (CLK,RESET) begin if RESET = '0' then DIVIDER <= "000000000000000000000000"; elsif CLK'event and CLK = '1' then DIVIDER <= DIVIDER + 1; end if; end process; SCAN_CLK <= DIVIDER(15); COUNT_CLK <= DIVIDER(24); --********************************** --* Counter Range From 00 to 31 * --********************************** process (COUNT_CLK,CLEAR) begin if CLEAR = '0' then COUNT_BCD <= "00000000"; elsif COUNT_CLK'event and COUNT_CLK = '1' then if COUNT_BCD(3 downto 0) = "1001" then COUNT_BCD(3 downto 0) <= "0000"; COUNT_BCD(7 downto 4) <= COUNT_BCD(7 downto 4) + 1; else COUNT_BCD(3 downto 0) <= COUNT_BCD(3 downto 0) + 1; end if; end if; end process; CLEAR <= RESET and COUNT_24; COUNT_24 <= '0' when COUNT_BCD(7 downto 0) = "00100100" else '1'; --********************************************* --* Decide Seven Segment's Display Location * --********************************************* process (SCAN_CLK,RESET) begin if RESET = '0' then POSITION <= "111110"; elsif SCAN_CLK'event and SCAN_CLK = '1' then POSITION <= "1111" & POSITION(1) & POSITION(2); end if; end process; ENABLE <= POSITION; --********************************************* --* Decide Seven Segment's Display Location * --********************************************* process (POSITION,COUNT_BCD) begin case POSITION is when "111110" => DECODE_BCD <= COUNT_BCD(3 downto 0); when "111101" => DECODE_BCD <= COUNT_BCD(7 downto 4); when others => null; end case; end process; --*********************************** --* BCD To Seven Segment Decoder * --*********************************** with DECODE_BCD select SEGMENT <= "1000000" when "0000", --0 "1111001" when "0001", --1 "0100100" when "0010", --2 "0110000" when "0011", --3 "0011001" when "0100", --4 "0010010" when "0101", --5 "0000010" when "0110", --6 "1111000" when "0111", --7 "0000000" when "1000", --8 "0010000" when "1001", --9 "1111111" when others; POINTER <= '1'; end Behavioral; --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 122.127.49.48
1F:推 CuckooBoy:when 不能放在if里面吧? 11/17 22:01







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Boy-Girl站内搜寻

TOP