基于vhdl語(yǔ)言的eda《洗衣機(jī)》數(shù)電課程設(shè)計(jì)_第1頁(yè)
已閱讀1頁(yè),還剩25頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、<p><b>  本科生課程設(shè)計(jì)</b></p><p>  課   程:數(shù)字電路課程設(shè)計(jì)</p><p><b>  題   目:洗衣機(jī)</b></p><p>  ?!  I(yè):電氣工程及其自動(dòng)化</p><p>  班   級(jí):電自12班</p><p>&l

2、t;b>  學(xué)   號(hào): </b></p><p><b>  姓   名: </b></p><p><b>  指導(dǎo) 老師: </b></p><p>  設(shè)計(jì) 時(shí)間:2012年6月22日</p><p>  一、課程設(shè)計(jì)的目的及要求:</p><p>

3、  1、能夠全面鞏固和應(yīng)用“電子技術(shù)基礎(chǔ)數(shù)字部分”課程中所學(xué)的基本理論和方法,并初步掌握小型數(shù)字系統(tǒng)設(shè)計(jì)的基本方法。</p><p>  2、掌握VHDL語(yǔ)言編制小型模塊的方法,并采用層次化設(shè)計(jì)。</p><p>  3、培養(yǎng)電路設(shè)計(jì)能力,懂得理論設(shè)計(jì)與實(shí)物實(shí)現(xiàn)的有效結(jié)合。</p><p>  4、掌握Altium Designer軟件的應(yīng)用。</p>

4、<p><b>  二.基本功能要求:</b></p><p>  要求設(shè)計(jì)制作一個(gè)普通功能洗衣機(jī)控制電路,使之能控制洗衣機(jī)的進(jìn)水閥,排水閥,洗滌程序電機(jī),甩干驅(qū)動(dòng)裝置等按預(yù)定程序工作??傮w過程包括:進(jìn)水、浸泡、洗滌、排水、甩干五個(gè)過程.進(jìn)水從電路啟動(dòng)開始。其中浸泡可供選擇,洗滌時(shí)間可以預(yù)置,洗滌結(jié)束時(shí)發(fā)出鈴聲進(jìn)行提示并自動(dòng)切斷電源。發(fā)生故障如:缺水或進(jìn)水超時(shí)、排水超時(shí)、甩干碰桶

5、等時(shí)也可自動(dòng)切斷電源!</p><p>  三.總體方案分析及選擇:</p><p>  洗衣機(jī)電路包含有總的控制模塊,洗滌控制模塊,洗滌記時(shí)模塊,電動(dòng)機(jī)控制模塊以及LCD液晶板的動(dòng)態(tài)顯示模塊。經(jīng)過分析后,我們把前四個(gè)模塊進(jìn)行組合,把他們合成一個(gè)模塊即:總控制模塊。他們之間的邏輯聯(lián)結(jié)關(guān)系,是對(duì)數(shù)電課程的一個(gè)很好總結(jié),也是自己對(duì)新知識(shí)(LCD液晶板的動(dòng)態(tài)顯示)學(xué)習(xí)理解運(yùn)用能力的一個(gè)很好的提升

6、機(jī)會(huì)。當(dāng)然也是團(tuán)隊(duì)合作,團(tuán)隊(duì)鍛煉的好機(jī)會(huì)。</p><p><b>  四.原理圖: </b></p><p><b>  五.局部功能模塊</b></p><p><b>  1.總控模塊:</b></p><p>  該模塊實(shí)現(xiàn)了對(duì)洗衣機(jī)整個(gè)運(yùn)行過程的控制,打開電源后由模塊

7、內(nèi)部進(jìn)行控制,按洗滌過程工致洗衣機(jī)的運(yùn)轉(zhuǎn).同時(shí)在輸入端還給了報(bào)警輸入,當(dāng)發(fā)生故障時(shí)洗衣機(jī)自動(dòng)短電.復(fù)位端可以讓洗衣機(jī)進(jìn)入初始狀態(tài).在輸入端還有10個(gè)總線輸入可以人為進(jìn)行置數(shù),從而控制各個(gè)過程的時(shí)間長(zhǎng)短.當(dāng)給甩干時(shí)間一個(gè)時(shí)間,其他都置為0可以讓洗衣機(jī)只進(jìn)行甩干操作.</p><p><b>  VHDL文件:</b></p><p>  library ieee;<

8、;/p><p>  use ieee.std_logic_1164.all;</p><p>  use ieee.std_logic_arith.all;</p><p>  use ieee.std_logic_unsigned.all;</p><p>  entity xiyiji is</p><p><b

9、>  port(</b></p><p>  clk0, clk1, rst, alarm: in std_logic;</p><p>  -----clk0:控制開關(guān)脈沖.clk1:記時(shí)開關(guān)脈沖.Rst:復(fù)位端.arlarm:報(bào)警輸入端.-------</p><p>  water_inh, water_inl, im_th, im_tl,

10、wash_th: in std_logic_vector(3 downto 0);</p><p>  wash_tl, water_outh, water_outl, dry_th, dry_tl: in std_logic_vector(3 downto 0); -----進(jìn)水,浸泡,洗滌,出水,甩干置數(shù)端高位和低位輸入端-----------</p><p>  water_in,

11、water_out, immersion, dry, z1, z2, voice, poweroff: out std_logic;</p><p>  -----進(jìn)水,出水,浸泡,甩干,洗滌,響鈴,斷電輸出端-------</p><p>  display_th, display_tl: out std_logic_vector(3 downto 0)</p><p

12、>  -------------------輸出時(shí)間顯示高位低位輸出端-------------</p><p><b>  );</b></p><p>  end entity xiyiji;</p><p>  architecture behave of xiyiji is</p><p>  signal

13、 js, js_ten : std_logic; --進(jìn)水</p><p>  signal im, im_ten : std_logic;--浸泡</p><p>  signal wa, wa_ten : std_logic;--洗衣</p><p>  signal wa1, wa2, pwf: std_logic;&

14、lt;/p><p>  signal cs, cs_ten : std_logic;--出水</p><p>  signal dr, dr_ten : std_logic;--甩干</p><p>  signal xl, xl_ten : std_logic;--響鈴</p><p>  signal js_dh, js_dl: std

15、_logic_vector(3 downto 0);</p><p>  signal im_dh, im_dl: std_logic_vector(3 downto 0);</p><p>  signal wa_dh, wa_dl: std_logic_vector(3 downto 0);</p><p>  signal cs_dh, cs_dl: std_

16、logic_vector(3 downto 0);</p><p>  signal dr_dh, dr_dl: std_logic_vector(3 downto 0);</p><p>  signal xl_dh, xl_dl: std_logic_vector(3 downto 0);</p><p>  signal dis_th,dis_tl: std_

17、logic_vector(3 downto 0);</p><p><b>  begin</b></p><p>  -----------------------控制:控制器件實(shí)現(xiàn)洗衣機(jī)的功能:進(jìn)水->浸泡->洗滌->出水->甩干->響鈴->斷電---------------</p><p>  cont

18、rol:process(clk0, rst,alarm)</p><p>  variable n: integer;</p><p><b>  begin</b></p><p>  if alarm = '1' then</p><p>  pwf <= '1';</p&

19、gt;<p><b>  else</b></p><p>  if rst = '1' then</p><p><b>  n := 0;</b></p><p>  im_ten <= '0';</p><p>  js_ten <=

20、'0';</p><p>  wa_ten <= '0';</p><p>  cs_ten <= '0';</p><p>  dr_ten <= '0';</p><p>  xl_ten <= '0';</p><

21、p>  pwf <= '0';</p><p>  elsif clk0 = '1' and clk0 'event then</p><p>  if n = 0 then</p><p>  if water_inh = "0000" and water_inl = "0000&q

22、uot; then</p><p><b>  n := 1;</b></p><p><b>  else</b></p><p>  js_ten <= '1';</p><p>  if js = '1' then</p><p>

23、<b>  n := 1;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  elsif js = '0' and n = 1 then</p><p>  if im_th =

24、"0000" and im_tl = "0000" then</p><p><b>  n := 2;</b></p><p><b>  else</b></p><p>  im_ten <= '1';</p><p>  if i

25、m = '1' then</p><p><b>  n := 2;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  elsif im = '0' and n =

26、 2 then</p><p>  if wash_th = "0000" and wash_tl = "0000" then</p><p><b>  n := 3;</b></p><p><b>  else</b></p><p>  wa_ten

27、<= '1';</p><p>  if wa = '1' then</p><p><b>  n := 3;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p&g

28、t;<p>  elsif wa = '0' and n = 3 then</p><p>  if water_outh = "0000" and water_outl = "0000" then</p><p><b>  n := 4;</b></p><p><

29、b>  else</b></p><p>  cs_ten <= '1';</p><p>  if cs = '1' then</p><p><b>  n := 4;</b></p><p><b>  end if;</b></p

30、><p><b>  end if;</b></p><p>  elsif cs = '0' and n = 4 then</p><p>  if dry_th = "0000" and dry_tl = "0000" then</p><p><b> 

31、 n := 5;</b></p><p><b>  else</b></p><p>  dr_ten <= '1';</p><p>  if dr = '1' then</p><p><b>  n := 5;</b></p>

32、<p><b>  end if;</b></p><p><b>  end if;</b></p><p>  elsif dr = '0' and n = 5 then</p><p>  xl_ten <= '1';</p><p>  if

33、xl = '1' then</p><p><b>  n := 6;</b></p><p><b>  end if;</b></p><p>  elsif xl = '0' and n = 6 then</p><p>  pwf <= '1&#

34、39;;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  -----------

35、------------------記時(shí)-----------------------------</p><p>  ------------------進(jìn)水記時(shí)--------------------------</p><p>  js_jishiqi:process(clk1, js_ten)</p><p><b>  begin</b&g

36、t;</p><p>  if js_ten = '0' then</p><p>  js_dh <= water_inh;</p><p>  js_dl <= water_inl;</p><p>  js <= '0';</p><p>  elsif clk1

37、 = '1' and clk1 'event then</p><p>  if js_dh = "0000" and js_dl = "0000" then</p><p>  js <= '0';</p><p><b>  else</b></p&

38、gt;<p>  js <= '1';</p><p>  if js_dl = "0000" then</p><p>  js_dl <= "1001"; </p><p>  js_dh <= js_dh - 1;&

39、lt;/p><p><b>  else</b></p><p>  js_dl <= js_dl - 1;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p><b>  

40、end if;</b></p><p>  end process;</p><p>  -------------浸泡記時(shí)-----------------------</p><p>  im_jishiqi:process(clk1, im_ten)</p><p><b>  begin</b><

41、;/p><p>  if im_ten = '0' then</p><p>  im_dh <= im_th;</p><p>  im_dl <= im_tl;</p><p>  im <= '0';</p><p>  elsif clk1 = '1'

42、; and clk1 'event then</p><p>  if im_dh = "0000" and im_dl = "0000" then</p><p>  im <= '0';</p><p><b>  else</b></p><p>

43、;  im <= '1';</p><p>  if im_dl = "0000" then</p><p>  im_dl <= "1001";</p><p>  im_dh <= im_dh - 1;</p><p><b>  else</b&g

44、t;</p><p>  im_dl <= im_dl - 1;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end

45、 process;</p><p>  -----------------洗滌記時(shí)----------------------</p><p>  wa_jishiqi:process(clk1, wa_ten)</p><p>  variable m: integer;</p><p><b>  begin</b>

46、</p><p>  if wa_ten = '0' then</p><p>  wa_dh <= wash_th;</p><p>  wa_dl <= wash_tl;</p><p>  wa <= '0';</p><p>  wa1 <= '0

47、';</p><p>  wa2 <= '0';</p><p><b>  m := 0;</b></p><p>  elsif clk1 = '1' and clk1 'event then</p><p>  if wa_dh = "0000&quo

48、t; and wa_dl = "0000" then</p><p>  wa <= '0';</p><p><b>  else</b></p><p>  wa <= '1';</p><p>  if m = 0 then</p>&l

49、t;p>  wa1 <= '1';</p><p>  wa2 <= '1';</p><p>  elsif m = 10 then</p><p>  wa1 <= '0';</p><p>  wa2 <= '1';</p>&l

50、t;p>  elsif m = 13 then</p><p>  wa1 <= '1';</p><p>  wa2 <= '0';</p><p>  elsif m = 23 then</p><p>  wa1 <= '0';</p><p&g

51、t;  wa2 <= '0';</p><p>  elsif m = 26 then</p><p><b>  m := 0;</b></p><p><b>  end if;</b></p><p>  m := m + 1;</p><p> 

52、 if wa_dl = "0000" then</p><p>  wa_dl <= "1001";</p><p>  wa_dh <= wa_dh - 1;</p><p><b>  else</b></p><p>  wa_dl <= wa_dl - 1

53、;</p><p><b>  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  --------------

54、出水記時(shí)---------------------------</p><p>  cs_jishiqi:process(clk1, cs_ten)</p><p><b>  begin</b></p><p>  if cs_ten = '0' then</p><p>  cs_dh <= w

55、ater_outh;</p><p>  cs_dl <= water_outl;</p><p>  cs <= '0';</p><p>  elsif clk1 = '1' and clk1 'event then</p><p>  if cs_dh = "0000&quo

56、t; and cs_dl = "0000" then</p><p>  cs <= '0';</p><p><b>  else</b></p><p>  cs <= '1';</p><p>  if cs_dl = "0000"

57、 then</p><p>  cs_dl <= "1001";</p><p>  cs_dh <= cs_dh - 1;</p><p><b>  else</b></p><p>  cs_dl <= cs_dl - 1;</p><p><b&

58、gt;  end if;</b></p><p><b>  end if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  --------------甩干記時(shí)-----------------------&

59、lt;/p><p>  dr_jishiqi:process(clk1, dr_ten)</p><p><b>  begin</b></p><p>  if dr_ten = '0' then</p><p>  dr_dh <= dry_th;</p><p>  dr_

60、dl <= dry_tl;</p><p>  dr <= '0';</p><p>  elsif clk1 = '1' and clk1 'event then</p><p>  if dr_dh = "0000" and dr_dl = "0000" then<

61、/p><p>  dr <= '0';</p><p><b>  else</b></p><p>  dr <= '1';</p><p>  if dr_dl = "0000" then</p><p>  dr_dl <=

62、"1001";</p><p>  dr_dh <= dr_dh - 1;</p><p><b>  else</b></p><p>  dr_dl <= dr_dl - 1;</p><p><b>  end if;</b></p><p&

63、gt;<b>  end if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  ------------------響鈴記時(shí)----------------------</p><p>  xl_jishiqi:proc

64、ess(clk1, xl_ten)</p><p><b>  begin</b></p><p>  if xl_ten = '0' then</p><p>  xl_dh <= "0010";</p><p>  xl_dl <= "0000";&

65、lt;/p><p>  xl <= '0';</p><p>  elsif clk1 = '1' and clk1 'event then</p><p>  if xl_dh = "0000" and xl_dl = "0000" then</p><p>

66、  xl <= '0';</p><p><b>  else</b></p><p>  xl <= '1';</p><p>  if xl_dl = "0000" then</p><p>  xl_dl <= "1001";

67、</p><p>  xl_dh <= xl_dh - 1;</p><p><b>  else</b></p><p>  xl_dl <= xl_dl - 1;</p><p><b>  end if;</b></p><p><b>  end

68、 if;</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  ----------------------------顯示時(shí)間--------------------------</p><p>  xianshishijian: pr

69、ocess(clk1, js_ten, im_ten, wa_ten)</p><p><b>  begin</b></p><p>  if js_ten = '1' and im_ten = '0' and wa_ten = '0' and cs_ten = '0' and dr_ten = 

70、9;0' and xl_ten = '0' then</p><p>  if clk1 = '1' and clk1 'event then</p><p>  dis_th <= js_dh;</p><p>  dis_tl <= js_dl;</p><p><b>

71、;  end if;</b></p><p>  elsif im_ten = '1' and wa_ten = '0' and cs_ten = '0' and dr_ten = '0' and xl_ten = '0' then</p><p>  if clk1 = '1' a

72、nd clk1 'event then</p><p>  dis_th <= im_dh;</p><p>  dis_tl <= im_dl;</p><p><b>  end if;</b></p><p>  elsif wa_ten = '1' and cs_ten = &

73、#39;0' and dr_ten = '0' and xl_ten = '0' then</p><p>  if clk1 = '1' and clk1 'event then</p><p>  dis_th <= wa_dh;</p><p>  dis_tl <= wa_dl;&l

74、t;/p><p><b>  end if;</b></p><p>  elsif cs_ten = '1' and dr_ten = '0' and xl_ten = '0' then</p><p>  if clk1 = '1' and clk1 'event then

75、</p><p>  dis_th <= cs_dh;</p><p>  dis_tl <= cs_dl;</p><p><b>  end if;</b></p><p>  elsif dr_ten = '1' and xl_ten = '0' then</p&g

76、t;<p>  if clk1 = '1' and clk1 'event then</p><p>  dis_th <= dr_dh;</p><p>  dis_tl <= dr_dl;</p><p><b>  end if;</b></p><p>  els

77、if xl_ten = '1' then</p><p>  if clk1 = '1' and clk1 'event then</p><p>  dis_th <= xl_dh;</p><p>  dis_tl <= xl_dl;</p><p><b>  end if;

78、</b></p><p><b>  end if;</b></p><p>  end process;</p><p>  ----------------------------輸出-----------------------------</p><p>  output:process(dis_th

79、, dis_tl, im, js, cs, dr, wa1, wa2, xl, pwf)</p><p><b>  begin</b></p><p>  display_th <= dis_th;</p><p>  display_tl <= dis_tl;</p><p>  immersion &l

80、t;= im;</p><p>  water_in <= js;</p><p>  water_out <= cs;</p><p>  dry <= dr;</p><p>  z1 <= wa1;</p><p>  z2 <= wa2;</p><p> 

81、 voice <= xl;</p><p>  poweroff <= pwf;</p><p>  end process;</p><p>  end behave;</p><p><b>  測(cè)試文件:</b></p><p>  ----------------------

82、--------------------------------------</p><p>  -- VHDL Testbench for xiyiji</p><p>  -- 2009 9 25 11 16 3</p><p>  -- Created by "EditVHDL"</p><p>  -- "

83、;Copyright (c) 2002 Altium Limited"</p><p>  ------------------------------------------------------------</p><p>  Library IEEE;</p><p>  Use IEEE.std_logic_1164.all;</p

84、><p>  Use IEEE.std_logic_textio.all;</p><p>  Use STD.textio.all;</p><p>  ------------------------------------------------------------</p><p>  -----------------

85、-------------------------------------------</p><p>  entity Testxiyiji is</p><p>  end Testxiyiji;</p><p>  ------------------------------------------------------------</p>&

86、lt;p>  ------------------------------------------------------------</p><p>  architecture stimulus of Testxiyiji is</p><p>  file RESULTS: TEXT open WRITE_MODE is "results.txt";<

87、/p><p>  procedure WRITE_RESULTS(</p><p>  alarm: std_logic;</p><p>  clk0: std_logic;</p><p>  clk1: std_logic;</p><p>  display_th: std_logic_vector(3 downt

88、o 0);</p><p>  display_tl: std_logic_vector(3 downto 0);</p><p>  dry: std_logic;</p><p>  dry_th: std_logic_vector(3 downto 0);</p><p>  dry_tl: std_logic_vector(3 dow

89、nto 0);</p><p>  im_th: std_logic_vector(3 downto 0);</p><p>  im_tl: std_logic_vector(3 downto 0);</p><p>  immersion: std_logic;</p><p>  poweroff: std_logic;</p&g

90、t;<p>  rst: std_logic;</p><p>  voice: std_logic;</p><p>  wash_th: std_logic_vector(3 downto 0);</p><p>  wash_tl: std_logic_vector(3 downto 0);</p><p>  water

91、_in: std_logic;</p><p>  water_inh: std_logic_vector(3 downto 0);</p><p>  water_inl: std_logic_vector(3 downto 0);</p><p>  water_out: std_logic;</p><p>  water_outh:

92、std_logic_vector(3 downto 0);</p><p>  water_outl: std_logic_vector(3 downto 0);</p><p>  z1: std_logic;</p><p>  z2: std_logic</p><p><b>  ) is</b></p&g

93、t;<p>  variable l_out : line;</p><p><b>  begin</b></p><p>  write(l_out, now, right, 15);</p><p>  write(l_out, alarm, right, 2);</p><p>  write(l_

94、out, clk0, right, 2);</p><p>  write(l_out, clk1, right, 2);</p><p>  write(l_out, display_th, right, 5);</p><p>  write(l_out, display_tl, right, 5);</p><p>  write(l_

95、out, dry, right, 2);</p><p>  write(l_out, dry_th, right, 5);</p><p>  write(l_out, dry_tl, right, 5);</p><p>  write(l_out, im_th, right, 5);</p><p>  write(l_out, im_

96、tl, right, 5);</p><p>  write(l_out, immersion, right, 2);</p><p>  write(l_out, poweroff, right, 2);</p><p>  write(l_out, rst, right, 2);</p><p>  write(l_out, voice,

97、 right, 2);</p><p>  write(l_out, wash_th, right, 5);</p><p>  write(l_out, wash_tl, right, 5);</p><p>  write(l_out, water_in, right, 2);</p><p>  write(l_out, water_i

98、nh, right, 5);</p><p>  write(l_out, water_inl, right, 5);</p><p>  write(l_out, water_out, right, 2);</p><p>  write(l_out, water_outh, right, 5);</p><p>  write(l_out

99、, water_outl, right, 5);</p><p>  write(l_out, z1, right, 2);</p><p>  write(l_out, z2, right, 2);</p><p>  writeline(RESULTS, l_out);</p><p>  end procedure;</p>

100、<p>  component xiyiji</p><p><b>  port (</b></p><p>  alarm: in std_logic;</p><p>  clk0: in std_logic;</p><p>  clk1: in std_logic;</p><

101、p>  display_th: out std_logic_vector(3 downto 0);</p><p>  display_tl: out std_logic_vector(3 downto 0);</p><p>  dry: out std_logic;</p><p>  dry_th: in std_logic_vector(3 downt

102、o 0);</p><p>  dry_tl: in std_logic_vector(3 downto 0);</p><p>  im_th: in std_logic_vector(3 downto 0);</p><p>  im_tl: in std_logic_vector(3 downto 0);</p><p>  immer

103、sion: out std_logic;</p><p>  poweroff: out std_logic;</p><p>  rst: in std_logic;</p><p>  voice: out std_logic;</p><p>  wash_th: in std_logic_vector(3 downto 0);<

104、/p><p>  wash_tl: in std_logic_vector(3 downto 0);</p><p>  water_in: out std_logic;</p><p>  water_inh: in std_logic_vector(3 downto 0);</p><p>  water_inl: in std_logic_

105、vector(3 downto 0);</p><p>  water_out: out std_logic;</p><p>  water_outh: in std_logic_vector(3 downto 0);</p><p>  water_outl: in std_logic_vector(3 downto 0);</p><p&g

106、t;  z1: out std_logic;</p><p>  z2: out std_logic</p><p><b>  );</b></p><p>  end component;</p><p>  signal alarm: std_logic;</p><p>  signal

107、clk0: std_logic;</p><p>  signal clk1: std_logic;</p><p>  signal display_th: std_logic_vector(3 downto 0);</p><p>  signal display_tl: std_logic_vector(3 downto 0);</p><

108、p>  signal dry: std_logic;</p><p>  signal dry_th: std_logic_vector(3 downto 0);</p><p>  signal dry_tl: std_logic_vector(3 downto 0);</p><p>  signal im_th: std_logic_vector(3 d

109、ownto 0);</p><p>  signal im_tl: std_logic_vector(3 downto 0);</p><p>  signal immersion: std_logic;</p><p>  signal poweroff: std_logic;</p><p>  signal rst: std_logic

110、;</p><p>  signal voice: std_logic;</p><p>  signal wash_th: std_logic_vector(3 downto 0);</p><p>  signal wash_tl: std_logic_vector(3 downto 0);</p><p>  signal water_

111、in: std_logic;</p><p>  signal water_inh: std_logic_vector(3 downto 0);</p><p>  signal water_inl: std_logic_vector(3 downto 0);</p><p>  signal water_out: std_logic;</p><

112、;p>  signal water_outh: std_logic_vector(3 downto 0);</p><p>  signal water_outl: std_logic_vector(3 downto 0);</p><p>  signal z1: std_logic;</p><p>  signal z2: std_logic;</

113、p><p><b>  begin</b></p><p>  DUT:xiyiji port map (</p><p>  alarm => alarm,</p><p>  clk0 => clk0,</p><p>  clk1 => clk1,</p><

114、;p>  display_th => display_th,</p><p>  display_tl => display_tl,</p><p>  dry => dry,</p><p>  dry_th => dry_th,</p><p>  dry_tl => dry_tl,</p>

115、<p>  im_th => im_th,</p><p>  im_tl => im_tl,</p><p>  immersion => immersion,</p><p>  poweroff => poweroff,</p><p>  rst => rst,</p><

116、;p>  voice => voice,</p><p>  wash_th => wash_th,</p><p>  wash_tl => wash_tl,</p><p>  water_in => water_in,</p><p>  water_inh => water_inh,</p&g

117、t;<p>  water_inl => water_inl,</p><p>  water_out => water_out,</p><p>  water_outh => water_outh,</p><p>  water_outl => water_outl,</p><p><b&g

118、t;  z1 => z1,</b></p><p><b>  z2 => z2</b></p><p><b>  );</b></p><p>  STIMULUS0:process</p><p><b>  begin</b></p>

119、<p>  alarm <= '0';</p><p>  dry_th <= "1000";</p><p>  dry_tl<= "0000";</p><p>  im_th <= "0000";</p><p>  im_

120、tl <= "0000";</p><p>  wash_th <= "0000";</p><p>  wash_tl <= "0000";</p><p>  water_inh <= "0000";</p><p>  water_i

121、nl <= "0000";</p><p>  water_outh <= "0000";</p><p>  water_outl <= "0000";</p><p>  rst <= '1';</p><p>  wait for 10n

122、s;</p><p>  rst <= '0';</p><p>  wait for 1000ns;</p><p>  alarm <= '1';</p><p><b>  wait;</b></p><p>  end process;</

123、p><p><b>  process</b></p><p><b>  begin</b></p><p>  clk0 <= '1';</p><p>  clk1 <= '1';</p><p>  wait for 1ns;&

124、lt;/p><p>  clk0 <= '0';</p><p>  clk1 <= '0';</p><p>  wait for 1ns;</p><p>  end process;</p><p>  WRITE_RESULTS(</p><p>

125、<b>  alarm,</b></p><p><b>  clk0,</b></p><p><b>  clk1,</b></p><p>  display_th,</p><p>  display_tl,</p><p><b> 

126、 dry,</b></p><p><b>  dry_th,</b></p><p><b>  dry_tl,</b></p><p><b>  im_th,</b></p><p><b>  im_tl,</b></p>

127、<p>  immersion,</p><p><b>  poweroff,</b></p><p><b>  rst,</b></p><p><b>  voice,</b></p><p><b>  wash_th,</b><

128、;/p><p><b>  wash_tl,</b></p><p><b>  water_in,</b></p><p>  water_inh,</p><p>  water_inl,</p><p>  water_out,</p><p>  

129、water_outh,</p><p>  water_outl,</p><p><b>  z1,</b></p><p><b>  z2</b></p><p><b>  );</b></p><p>  end architecture;&l

130、t;/p><p><b>  波形圖:</b></p><p><b>  2.顯示模塊:</b></p><p>  此模塊實(shí)現(xiàn)將由控制器件產(chǎn)生的時(shí)間顯示的BCD碼與地址選擇信號(hào)同步的轉(zhuǎn)化成可供LCD顯示的ASCII碼并同時(shí)顯示字母WELCOME的功能!</p><p><b>  VHDL

131、文件:</b></p><p>  LIBRARY IEEE;</p><p>  USE IEEE.std_Logic_1164.ALL;</p><p>  ENTITY OUTPUT IS</p><p><b>  PORT</b></p><p>  (R, CP, BUSY

132、 :IN Std_Logic; --復(fù)位,時(shí)鐘,輸入信號(hào)忙輸入端</p><p>  LINE_OUT,STROBE,RST:OUT STD_LOGIC;--行,輸入數(shù)據(jù),復(fù)位</p><p>  TIME_IN :IN STD_LOGIC_VECTOR(7 DOWNTO 0);---時(shí)間輸入</p><p>  ADDR_OUT :OUT Std_Logic_Ve

133、ctor( 3DOWNTO 0);--地址輸入</p><p>  DATA_OUT : OUT Std_Logic_Vector(7 DOWNTO 0));--數(shù)據(jù)輸出</p><p>  END OUTPUT;</p><p>  ARCHITECTURE XS OF OUTPUT IS</p><p>  TYPE State_type

134、 IS(S0,S1,S2,S3,S4);</p><p>  SIGNAL S :State_Type;</p><p>  SIGNAL LCDPT:INTEGER RANGE 0 TO 13;</p><p><b>  BEGIN</b></p><p>  PROCESS(CP,R)</p><

135、;p><b>  BEGIN</b></p><p>  IF R='1' THEN</p><p>  S<=S0;LCDPT<=0;RST<='1';</p><p>  ELSIF CP='1' AND CP 'EVENT THEN</p>&l

136、t;p><b>  CASE S IS</b></p><p>  WHEN S0=> S<=S1;LCDPT<=0;RST<='1';</p><p>  WHEN S1=> RST<='0';STROBE<='0';</p><p>  IF B

137、USY='0' THEN</p><p>  LCDPT<=LCDPT+1;</p><p>  IF LCDPT=12 THEN</p><p><b>  S<=S3;</b></p><p><b>  ELSE</b></p><p>&l

138、t;b>  S<=S2;</b></p><p><b>  END IF;</b></p><p><b>  END IF;</b></p><p>  WHEN S2=> S<=S1;STROBE<='1';</p><p>  WHE

139、N S3=> STROBE<='0';</p><p>  IF BUSY='0' THEN</p><p>  IF LCDPT=13 THEN</p><p>  LCDPT<=12;</p><p><b>  ELSE</b></p><p&g

140、t;  LCDPT<=LCDPT+1;</p><p><b>  END IF;</b></p><p><b>  S<=S4;</b></p><p><b>  END IF;</b></p><p>  WHEN S4=> STROBE<=&#

141、39;1';S<=S3;</p><p>  WHEN OTHERS=> NULL;</p><p><b>  END CASE;</b></p><p><b>  END IF;</b></p><p>  END PROCESS;</p><p>

142、  PROCESS (LCDPT)</p><p><b>  BEGIN</b></p><p>  CASE LCDPT IS</p><p>  WHEN 0 => NULL;</p><p>  WHEN 1 => DATA_OUT<="01010111" ; ADDR_OU

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論