VHDL12864显示采样电压

VHDL12864显示采样电压

ID:40582287

大小:33.00 KB

页数:3页

时间:2019-08-04

VHDL12864显示采样电压_第1页
VHDL12864显示采样电压_第2页
VHDL12864显示采样电压_第3页
资源描述:

《VHDL12864显示采样电压》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、//12864显示“采样电压”及keyin输入数字量的后转化为数字:如(“11111”为5.0V)//本例程只是提供一个思路libraryieee;useieee.std_logic_1164.all;useieee.std_logic_arith.all;useieee.std_logic_unsigned.all;entitylcd12864isport(clk,reset:instd_logic;en,rw,rs:OUTstd_logic;data:outstd_logic_vector(7downto0

2、);keyin:instd_logic_vector(4downto0));endentitylcd12864;architecturebehavoflcd12864istypestatesis(st0,st1,st2,st3,st4,st5,st6);typeram1isarray(0to9)ofstd_logic_vector(7downto0);typeram2isarray(0to7)ofstd_logic_vector(7downto0);constantcgram1:ram1:=(x"30",x"3

3、1",x"32",x"33",x"34",x"35",x"36",x"37",x"38",x"39");--0123456789的ASCII码constantcyda:ram2:=(x"b2",x"c9",x"d1",x"f9",x"b5",x"e7",x"d1",x"b9");//“采样电压”可查看12864字符手册signalcurrent_state:states;signallcd_clk,clk_out:std_logic;signalshi_clk,yifen_clk,shifen_clk,yimi

4、ao_clk,shimiao_clk:std_logic;signalad:integer;beginprocess(CLK)variablen1:integerrange0to100000;--将输入时钟分频为250hz,4msbeginifrising_edge(Clk)thenifn1<100000thenn1:=n1+1;elsen1:=0;Clk_Out<=notClk_Out;endif;endif;endprocess;en<=clk_out;lcd_clk<=clk_out;RW<='0';pr

5、ocess(clk)beginifclk'eventandclk='1'thenad<=conv_integer(keyin);endif;endprocess;process(LCD_Clk,Reset,Current_State)variablecn2:integerrange0to10;variablemiaoge,miaoshi,fenge,fenshi,shi1,shi2:integerrange0to9;beginifReset='0'thenCurrent_State<=st0;RS<='0';e

6、lsifrising_edge(LCD_Clk)thenCurrent_State<=Current_State;RS<='0';shi2:=(ad-1)/6;shi1:=(ad-1)mod6;caseCurrent_Stateiswhenst0=>--基本指令集动作Data<="00110000";Current_State<=st1;whenst1=>--整体显示设置:光标off反光off:0x0cData<="00001100";Current_State<=st2;--endif;whenst2=>--

7、清除显示,并且认定地址指针为00h:0x01Data<="00000001";Current_State<=st3;whenst3=>--指定游标的移动方向及指定显示的移位:06Data<="00000110";Current_State<=st4;whenst4=>--地址设定从第一行的第一个字开始显示到第五个字地址设定ifcn2<6thencn2:=cn2+1;elsecn2:=0;endif;ifcn2=0thendata<="10001000";--0x80elsifcn2=1thendata<="10

8、001001";--0x81elsifcn2=2thendata<="10000000";--0x82elsifcn2=3thendata<="10000001";--0x83elsifcn2=4thendata<="10000010";--0x83elsifcn2=5thendata<="10000011";--0x83elsifcn2=6thendata<="10001010";-

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。