基于FPGA的數(shù)字系統(tǒng)設(shè)計(jì)實(shí)驗(yàn)lcd顯示字符OK的程序_第1頁
基于FPGA的數(shù)字系統(tǒng)設(shè)計(jì)實(shí)驗(yàn)lcd顯示字符OK的程序_第2頁
基于FPGA的數(shù)字系統(tǒng)設(shè)計(jì)實(shí)驗(yàn)lcd顯示字符OK的程序_第3頁
基于FPGA的數(shù)字系統(tǒng)設(shè)計(jì)實(shí)驗(yàn)lcd顯示字符OK的程序_第4頁
基于FPGA的數(shù)字系統(tǒng)設(shè)計(jì)實(shí)驗(yàn)lcd顯示字符OK的程序_第5頁
已閱讀5頁,還剩12頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、timescale 1ns / 1ps/ Company: / Engineer: / / Create Date: 15:48:30 04/21/2015 / Design Name: / Module Name: lcd / Project Name: / Target Devices: / Tool versions: / Description: / Dependencies: / Revision: / Revision 0.01 - File Created/ Additional Comments: /module lcd(clk,reset,lcd_rs,lcd_rw,lcd_

2、e,lcd_d,flash_ce); input clk; input reset; output lcd_rs; output lcd_rw; output lcd_e; output 3:0 lcd_d; output flash_ce; reg lcd_rs,lcd_e; reg3:0 lcd_d; assign flash_ce = 1; assign lcd_rw = 0; reg 19:0 delay_count; reg 19:0 num_count; parameter state1 = 6b000001; parameter state2 = 6b000010; parame

3、ter state3 = 6b000011; parameter state4 = 6b000100; parameter state5 = 6b000101; parameter state6 = 6b000110; parameter state7 = 6b000111; parameter state8 = 6b001000; parameter state9 = 6b001001; parameter state10 = 6b001010; parameter state11 = 6b001011; parameter state12 = 6b001100; parameter sta

4、te13 = 6b001101; parameter state14 = 6b001110; parameter state15 = 6b001111; parameter state16 = 6b010000; parameter state17 = 6b010001; parameter state18 = 6b010010; parameter state19 = 6b010011; parameter state20 = 6b010100; parameter state21 = 6b010101; parameter state22 = 6b010110; parameter sta

5、te23 = 6b010111; parameter state24 = 6b011000; parameter state25 = 6b011001; parameter state26 = 6b011010; parameter state27 = 6b011011; parameter state28 = 6b011100; parameter state29 = 6b011101; parameter state30 = 6b011110; parameter state31 = 6b011111; parameter state32 = 6b100000; parameter sta

6、te33 = 6b100001; parameter state34 = 6b100010; parameter state35 = 6b100011; parameter state36 = 6b100100; parameter state37 = 6b100101; parameter state38 = 6b100110; parameter state39 = 6b100111; parameter state40 = 6b101000; parameter state41 = 6b101001; parameter state42 = 6b101010; parameter sta

7、te43 = 6b101011; parameter state44 = 6b101100; parameter state45 = 6b101101; parameter state46 = 6b101110; parameter state47 = 6b101111; parameter state48 = 6b110000; parameter state49 = 6b110001; parameter state50 = 6b110010; parameter state51 = 6b110011; parameter state52 = 6b110100; parameter sta

8、te53 = 6b110101; parameter state54 = 6b110110; parameter state55 = 6b110111; parameter state56 = 6b111000; parameter state57 = 6b111001; parameter state58 = 6b111010; parameter state59 = 6b111011; reg 5:0 state; reg state_change; always (posedge clk or posedge reset) if(reset) begin state_change = 1

9、b0; delay_count = 1b1; end else if(delay_count = num_count - 1) begin state_change = 1b1; delay_count = 1b1; end else begin state_change = 1b0; delay_count = delay_count + 1b1; end always (posedge state_change or posedge reset) if(reset) begin state = state1; num_count = 20d750000; end else case(sta

10、te) state1:begin state = state2; num_count = 20d4; lcd_rs = 1b0; lcd_e = 1b0; lcd_d = 4h3; end state2:begin state = state3; num_count = 20d12; lcd_e = 1b1; end state3:begin state = state4; num_count = 20d205000; lcd_e = 1b0; end state4:begin state = state5; num_count = 20d4; lcd_d = 4h3; end state5:

11、begin state = state6; num_count = 20d12; lcd_e = 1b1; end state6:begin state = state7; num_count = 20d5000; lcd_e = 1b0; end state7:begin state = state8; num_count = 20d4; lcd_d = 4h2; end state8:begin state = state9; num_count = 20d12; lcd_e = 1b1; end state9:begin state = state10; num_count = 20d4

12、000; lcd_e = 1b0; end /set funtion mode state10:begin state = state11; num_count = 20d4; lcd_rs = 0; lcd_d = 4h2; end state11:begin state = state12; num_count = 20d12; lcd_e = 1b1; end state12:begin state = state13; num_count = 20d80; lcd_e = 1b0; end state13:begin state = state14; num_count = 20d4;

13、 lcd_d = 4h8; end state14:begin state = state15; num_count = 20d12; lcd_e = 1b1; end state15:begin state = state16; num_count = 20d4000; lcd_e = 1b0; end /set entry mode state16:begin state = state17; num_count = 20d4; lcd_d = 4h0; end state17:begin state = state18; num_count = 20d12; lcd_e = 1b1; e

14、nd state18:begin state = state19; num_count = 20d80; lcd_e = 1b0; end state19:begin state = state20; num_count = 20d4; lcd_d = 4h6; end state20:begin state = state21; num_count = 20d12; lcd_e = 1b1; end state21:begin state = state22; num_count = 20d4000; lcd_e = 1b0; end /set display on/off state22:

15、begin state = state23; num_count = 20d4; lcd_d = 4h0; end state23:begin state = state24; num_count = 20d12; lcd_e = 1b1; end state24:begin state = state25; num_count = 20d80; lcd_e = 1b0; end state25:begin state = state26; num_count = 20d4; lcd_d = 4hc; end state26:begin state = state27; num_count =

16、 20d12; lcd_e = 1b1; end state27:begin state = state28; num_count = 20d4000; lcd_e = 1b0; end /clear display state28:begin state = state29; num_count = 20d4; lcd_d = 4h0; end state29:begin state = state30; num_count = 20d12; lcd_e = 1b1; end state30:begin state = state31; num_count = 20d80; lcd_e =

17、1b0; end state31:begin state = state32; num_count = 20d4; lcd_d = 4h1; end state32:begin state = state33; num_count = 20d12; lcd_e = 1b1; end state33:begin state = state34; num_count = 20d2000; lcd_e = 1b0; end state34:begin state = state35; num_count = 20d82000; end /set DD RAM address state35:begi

18、n state = state36; num_count = 20d4; lcd_rs = 1b0; lcd_e = 1b0; lcd_d = 4h8; end state36:begin state = state37; num_count = 20d12; lcd_e = 1b1; end state37:begin state = state38; num_count = 20d80; lcd_e = 1b0; end state38:begin state = state39; num_count = 20d4; lcd_d = 4h0; end state39:begin state

19、 = state40; num_count = 20d12; lcd_e = 1b1; end state40:begin state = state41; num_count = 20d4000; lcd_e = 1b0; end / now starts writing data to DD RAM state41:begin state = state42; num_count = 20d4; lcd_rs = 1b1; lcd_d = 4h4; end state42:begin state = state43; num_count = 20d12; lcd_e = 1b1; end

20、state43:begin state = state44; num_count = 20d80; lcd_e = 1b0; end state44:begin state = state45; num_count = 20d4; lcd_d = 4hf; end state45:begin state = state46; num_count = 20d12; lcd_e = 1b1; end state46:begin state = state47; num_count = 20d2000; lcd_e = 1b0; end state47:begin state = state48;

21、num_count = 20d4; lcd_rs = 1b1; lcd_d = 4h4; end state48:begin state = state49; num_count = 20d12; lcd_e = 1b1; end state49:begin state = state50; num_count = 20d80; lcd_e = 1b0; end state50:begin state = state51; num_count = 20d4; lcd_d = 4hb; end state51:begin state = state52; num_count = 20d12; l

22、cd_e = 1b1; end state52:begin state = state53; num_count = 20d2000; lcd_e = 1b0; end state53:begin state = state54; num_count = 20d4; lcd_rs = 1b1; lcd_d = 4h2; end state54:begin state = state55; num_count = 20d12; lcd_e = 1b1; end state55:begin state = state56; num_count = 20d80; lcd_e = 1b0; end state56:begin state = state57; num_count = 20d4; lcd_d = 4h1; end state57:begin state = state58; num_count = 20d12; lcd_e = 1b1; end state58:begin state = state59; num_count = 20d4000; lcd_e = 1b0; end state59:begin sta

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(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)論