【文章內(nèi)容簡介】
=0000。m4:=m4+1。m:=m+1。 elsif(m1=9 and m2=9) then m1:=0000。m2:=0000。m3:=m3+1。m:=m+1。 elsif(m1=9) then m1:=0000。m2:=m2+1。m:=m+1。 else m1:=m1+1。m:=m+1。 end if。 else m:=0。m1:=0000。m2:=0000。m3:=0000。m4:=0000。 end if。end if。mg=m1。ms=m2。mb=m3。mq=m4。end process。end tran。 Sel 通過選擇器將路程和車費每位分別輸出,送到數(shù)碼管library ieee。 use 。use 。entity sel isport( c:in std_logic_vector(2 downto 0)。 dg,ds,db,dq,mg,ms,mb,mq:in std_logic_vector(3 downto 0)。 da:out std_logic_vector(3 downto 0) )。 end sel。architecture se of sel isbegin process(c,dg,ds,db,dq,mg,ms,mb,mq) variable co :std_logic_vector(2 downto 0)。 begin co:=c。 case co is when 000=da=dg。 when 001=da=ds。when 010=da=db。 when 011=da=dq。when 100=da=mg。 when 101=da=ms。when 110=da=mb。 when 111=da=mq。when others=null。end case。end process。end se。 W 用第一次分頻過的脈沖實現(xiàn)八進制計數(shù),為下面實現(xiàn)動態(tài)掃描做準(zhǔn)備library ieee。use 。use 。entity w isport( clk:in std_logic。 a:out std_logic_vector(2 downto 0))。end w。architecture ch1 of w isbegin process(clk) variable b:std_logic_vector(2 downto 0)。 begin if(clk39。event and clk=39。139。) then if(b=111) then b:=000。 else b:=b+1。 end if。 end if。 a=b。 end process。end ch1。 3—8譯碼器:通過八進制計數(shù)實現(xiàn)動態(tài)掃描library ieee。use 。entity mux38a isport(d:in std_logic_vector(2 downto 0)。q:out std_logic_vector(7 downto 0))。end mux38a。architecture one of mux38a isbeginprocess(d)begincase d iswhen 000=q=11101111。when 001=q=11011111。when 010=q=10111111。when 011=q=01111111。when 100=q=11111110。when 101=q=11111101。when 110=q=11111011。when 111=q=11110111。when others=null。end case。end process。end one。 數(shù)碼管顯示:顯示模塊由8個七段LED數(shù)碼管組成。各個模塊用四個數(shù)碼管,三個表示整數(shù)部分,一個表示小數(shù)部分。由于小數(shù)點的位置是固定的,因此可以將小數(shù)點接到一個固定的高電平上一直顯示。library ieee。use 。entity led isport( a : in std_logic_vector(3 downto 0)。L: out std_logic_vector(6 sownto 0)