资源描述:
《基于fpga的数字系统设计实验3控制液晶显示屏显示字符ok》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Jian程序libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STDLOGICUNSIGNED.ALL;——Uncommentthefollowinglibrarydeclarationifinstantiating——anyXilinxprimitivesinthiscode.-libraryUNISIM;-useUNISIM.VComponents.all;entityledisport(elk
2、,reset:inbit;SF_D:outbit_vector(3downto0);LCD_E,LCD_RS,LCD_RW,SF_CEO:outbit;LED:outbit_vector(7downto0));endled;architecturebehaviorofledistypetx_sequenceis(high_setup,high_hold,oneus,low_setup,low_hold,fortyus,done);signaltx_state:tx_sequence:=done;s
3、ignaltx_byte:bit_vector(7downto0);signaltx_init:bit:=V;typeinit_sequenceis(idle,fifteenms,one,two,three,four,five,six,seven,eight,done);signalinit_state:init_sequence:=idle;signalinit_init,init_done:bit:=‘0;signali:integerrange0to750000:=0;signali2:in
4、tegerrange0to2000:=0;signali3:integerrange0to82000:=0;signalSF_D0,SF_D1:bit_vector(3downto0);signalLCD_E0,LCD_E1:bit;signalmux:bit;typedisplay_stateis(init,function_set,entry_set,set_display,clr_display,pause,set_addr,char_f,char_p,char_g,char_a,done)
5、;signalcur_state:display_state:=init;beginLED<=tx_byte;-fordiagnosticpurposesSF_CE0<=T;—disableintelstrataflashLCD_RWv二'O';—writeonly-Thefollowing"with”statementssimplifytheprocessofaddingandremovingstates.-whentotransmitacommand/dataandwhennottowithc
6、ur_stateselecttx_init<=Owheninit
7、pause
8、done,Twhenothers;-controlthebuswithcur_stateselectmuxv二Twheninit,‘0’whenothers;-controltheinitializationsequencewithcur_stateselectinitjnit<=Twheninit,XXwhenothers;—registerselectwithcur_stateselectLCD_RSv=Owhenf
9、unction_set
10、entry_set
11、set_display
12、clr_display
13、set_addr,Twhenothers;—whatbytetotransmittoled-refertodatasheetforanexplanationofthesevalueswithcur_stateselecttx_byte<='*00101000"whenfunction_set,"00000110"whenentry_set,"00001100"whenset_display,“0000000
14、1”whenclr_display,"10000000"whenset_addr,”01001010”whenchar_J,^^010()l()01,^whenchar_I,“01000001”whenchar_A,“01001110“whenchar_N,"00000000"whenothers;—mainstatemachinedisplay:process(clk,reset)beginif(reset='l')thencur_state<=function_set;elsi