资源描述:
《LCD12864驱动程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityLCD_12864isgeneric(divide_500k:integer:=20;cnt1_value:integer:=50);port(clk,reset:instd_logic;psb:outstd_logic;rs,rw,en:outstd_logic;data:outstd_logic_vector(7downto0)--ss,,sg,fs,fg,ms,mg,ds,dg,js,j
2、g,ls,lg,mh:inSTD_LOGIC_VECTOR(7downto0));endentity;architecturebehaviorofLCD_12864istypeword1isarray(0to5)ofstd_logic_vector(7downto0);typeword2isarray(0to9)ofstd_logic_vector(7downto0);typeword3isarray(0to7)ofstd_logic_vector(7downto0);typestateis(set_dlnf1,set_dlnf2,set_c
3、ursor,set_dcb,set_shift,set_ddram1,set_ddram2,set_ddram3,set_ddram4,set_ddram5,write_shijian,write_ddshijian,write_zongje,write_licheng,write_xuexiao,over,sta1,sta2,sta3,sta4,write_shizhong1,write_shizhong2,write_shizhong3,write_shizhong4,write_shizhong5,write_shizhong6,wri
4、te_shizhong7,write_shizhong8,write_shizhong9,write_shizhong10,write_shizhong11,write_ddsj1,write_ddsj2,write_zje1,write_zje2,write_lc1,write_lc2);constantshijian:word1:=("11001010","10110001","10111100","11100100","10100001","11000011");constantddshijian:word2:=("10110101",
5、"11001000","10110100","11111101","11001010","10110001","10111100","11100100","10100001","11000011");constantzongje:word3:=("11010111","11011100","10111101","11110000","10110110","11101110","10100001","11000011");constantlicheng:word1:=("11000000","11101111","10110011","1100
6、1100","10100001","11000011");constantxuexiao:word3:=("11001101","10101101","11001000","11001010","11010001","10100111","11010100","10111010");signalpr_state:state;signalnewclk:std_logic;beginpsb<='1';process(clk)isvariablenum:integerrange0todivide_500k;beginif(clk'eventandc
7、lk='1')thennum:=num+1;if(num=divide_500k)thennum:=0;endif;if(num8、ate<=set_dlnf1;cnt1:=0;cnt2:=0;en<='0';data<="ZZZZZZZZ";elsif(newclk'eventandnewcl