


全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
/12864显示 “采样电压”及 keyin 输入数字量的后转化为 数字 :如(“11111”为 5.0V )/本例程只是提供一个思路library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity lcd12864 is port( clk,reset: in std_logic; en,rw,rs: OUT std_logic; data: out std_logic_vector(7 downto 0); keyin:in std_logic_vector(4 downto 0);end entity lcd12864 ;architecture behav of lcd12864 is type states is(st0,st1,st2,st3,st4,st5,st6); type ram1 is array(0 to 9) of std_logic_vector(7 downto 0); type ram2 is array(0 to 7) of std_logic_vector(7 downto 0); constant cgram1 : ram1 :=(x30,x31,x32,x33,x34,x35,x36,x37,x38,x39); -0123456789的ASCII码 constant cyda : ram2:=(xb2,xc9,xd1,xf9,xb5,xe7,xd1,xb9);/“采样电压”可查看12864字符手册 signal current_state: states; signal lcd_clk,clk_out:std_logic; signal shi_clk,yifen_clk,shifen_clk,yimiao_clk,shimiao_clk:std_logic; signal ad:integer; beginprocess(CLK) variable n1:integer range 0 to 100000; -将输入时钟分频为250hz,4ms begin if rising_edge(Clk) then if n1100000 then n1:=n1+1; else n1:=0; Clk_Out=not Clk_Out; end if; end if;end process;en=clk_out;lcd_clk=clk_out; RW = 0 ;process(clk)begin if clkevent and clk=1 thenad=conv_integer(keyin);end if;end process;process(LCD_Clk,Reset,Current_State) variable cn2: integer range 0 to 10 ;variable miaoge,miaoshi,fenge,fenshi,shi1,shi2:integer range 0 to 9; begin if Reset=0 then Current_State=st0; RS=0; elsif rising_edge(LCD_Clk) then Current_State = Current_State ; RS -基本指令集动作 Data=00110000; Current_State - 整体显示设置:光标off 反光off:0x0c Data=00001100; Current_State -清除显示,并且认定地址指针为00h:0x01 Data=00000001; Current_State -指定游标的移动方向及指定显示的移位:06 Data=00000110; Current_State -地址设定 从第一行的第一个字开始显示到第五个字 地址设定if cn26 then cn2:=cn2+1; else cn2:=0; end if; if cn2=0 then data=10001000;-0x80 elsif cn2=1 then data=10001001;-0x81 elsif cn2=2 then data=10000000;-0x82 elsif cn2=3 then data=10000001;-0x83 elsif cn2=4 then data=10000010;-0x83 elsif cn2=5 then data=10000011;-0x83 elsif cn2=6 then data=10001010;-0x83 end if; Current_State -送数据1 一个字地址可以放两个数字,所以一个地址送两次数据 rs=1; if cn2=0 then data=cgram1(conv_integer(shi2); elsif cn2=1 then data=cgram1(conv_integer(shi1);elsif cn2=2 then data=cyda(0);elsif cn2=3 then data=cyda(2);elsif cn2=4 then data=cyda(4);elsif cn2=5 then data=cyda(6);elsif cn2=6 then data=01010110;end if; current_state -送数据2rs=1;if cn2=0 then data=00101110; elsif cn2=1 then data=00100000; elsif cn2=2 then data=cyda(1); elsif cn2=3 then data=cyda(3);elsif cn2=4 then data=cyda(5);elsif c
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 新解读《GB-T 32498-2016金属基复合材料 拉伸试验 室温试验方法》
- 高砂窑炉安全知识培训课件
- 北京交通运输管理考试及答案
- PhIP-Standard-生命科学试剂-MCE
- BAT-1308-生命科学试剂-MCE
- 北华大学线上考试题目及答案
- 保育师考试题中级题库及答案
- 家政中级考试题及答案
- 中级软考试题及答案
- 电炉知识培训总结与反思课件
- 陕西省西安市高新一中、交大附中2025届高三第四次模拟考试化学试卷含解析
- 落地扣件式钢管脚手架拆除方案
- 老年病科科室制度
- 机房整改方案
- 2023年福建中考语文试卷真题及答案解析
- 未成年人保护法普法宣传教育课件
- 智慧车辆管理系统解决方案
- 《泌尿系统护理》课件
- 化学奇妙之旅
- 《化工仪表知识培训》课件
- DB21T 2655-2016 花生节本增效栽培技术规程
评论
0/150
提交评论