您好,欢迎光临本网站![请登录][注册会员]  
文件名称: FPGA 控制 LCD 1602
  所属分类: 嵌入式
  开发工具:
  文件大小: 700kb
  下载次数: 0
  上传时间: 2012-10-07
  提 供 者: yeg****
 详细说明: FPGA 控制 LCD 1602调试笔记 初始化步骤: 1、0x38 设置为16*2显示,5*7点阵,8位数据接口 2、0x0C 说明 这里0c表示的是开显示,不显示光标,光标不显示,完整描述如下: 3、0x01 清屏幕 4、0x06 表示读或者写之后,地址指针加1,光标加1 5、0x80 位置寄存器定位于第一行的最左边 时序图: 在本例中采用50兆分频到1k的时钟,也就是E的保持时间是1ms,达到以上的时序要求。 在Altera的DEO上验证通过,显示效果如下: 完整代码如下: (本实例中,显示大写的LOVE!,第二行显示www.txsky.net) module lcm(LCD_ON, CLOCK_50, LCD_DATA, LCD_RW, LCD_RS, LCD_EN, LCD_BLON ); input CLOCK_50; output [7:0]LCD_DATA; output LCD_RW; output LCD_RS; output LCD_EN; output LCD_BLON; output LCD_ON; reg [7:0]LCD_DATA; reg LCD_RW ; reg LCD_ RS; reg LCD_EN; reg clk_1k=1'b0; reg [20:0]counter=0; reg [10:0]counter1=0; assign LCD_BLON=1;//这里要么不设置数据类型,要么设置为wire assign LCD_ON=1;// 这里要么不设置数据类型,要么设置为wire always@(posedge CLOCK_50) if(counter==25000) begin clk_1k<=~clk_1k; counter<=0; end else counter<=counter+1; always@(posedge clk_1k)// //很巧妙的利用时钟来解决延时问题,特别是在时序电路的//时候 begin if(counter1<1023)//这里counter1没有给定它为0的条件,及counter1是一次性 counter1<=counter1+1;//执行的。当counter1超过1023这个值时counter1保持不变//这样下面要显示的数就会保持稳定。 casex (counter1) 400:begin LCD_DATA<=8'b00111000; //0x38 设置显示模式 LCD_RW<=1'b0; LCD_RS<=1'b0; end 401:LCD_EN<=1'b1; 410: //0x0c 开显示 关光标 begin LCD_DATA<=8'b00001100; LCD_RW<=1'b0; LCD_RS<=1'b0; end 411: LCD_EN<=1'b1; 420: begin //0x01 清屏幕 LCD_DATA<=8'b00000001; LCD_RW<=1'b0; LCD_RS<=1'b0; end 421: LCD_EN<=1'b1; 430: begin //0x06 读或者写后 自动加1 LCD_DATA<=8'b00000110; LCD_RW<=1'b0; LCD_RS<=1'b0; end 431: LCD_EN<=1'b1; 440:begin //0xc0 定位到第二行 LCD_DATA<=8'b11000000; LCD_RW<=1'b0; LCD_RS<=1'b0; end 441: begin LCD_EN<=1'b1; ack<=1;//这里是多余的, end 450: begin //write data W LCD_DATA<=8'h57; LCD_RW<=1'b0; LCD_RS<=1'b1; end 451: LCD_EN<=1'b1; 460: begin //write data W LCD_DATA<=8'h57; LCD_RW<=1'b0; LCD_RS<=1'b1; end 461: LCD_EN<=1'b1; 470: begin //write data W LCD_DATA<=8'h57; LCD_RW<=1'b0; LCD_RS<=1'b1; end 471: LCD_EN<=1'b1; 480: begin //write data . LCD_DATA<=8'h2E; LCD_RW<=1'b0; LCD_RS<=1'b1; end 481: LCD_EN<=1'b1; 490: begin //write data T LCD_DATA<=8'h54; LCD_RW<=1'b0; LCD_RS<=1'b1; end 491: LCD_EN<=1'b1; 500:begin //write data X LCD_DATA<=8'h58; LCD_RW<=1'b0; LCD_RS<=1'b1; end 501: LCD_EN<=1'b1; 510:begin //write data S LCD_DATA<=8'h53; LCD_RW<=1'b0; LCD_RS<=1'b1; end 511: LCD_EN<=1'b1; 520: begin //write data K LCD_DATA<=8'h4B; LCD_RW<=1'b0; LCD_RS<=1'b1; end 521: LCD_EN<=1'b1; 530: begin //write data Y LCD_DATA<=8'h59; LCD_RW<=1'b0; LCD_RS<=1'b1; end 531: LCD_EN<=1'b1; 540: begin //write data . LCD_DATA<=8'h2E; LCD_RW<=1'b0; LCD_RS<=1'b1; end 541: LCD_EN<=1'b1; 550: begin //write data N LCD_DATA<=8'h4E; LCD_RW<=1'b0; LCD_RS<=1'b1; end 551: LCD_EN<=1'b1; 560: begin //write data E LCD_DATA<=8'h45; LCD_RW<=1'b0; LCD_RS<=1'b1; end 561: LCD_EN<=1'b1; 570: begin //write data T LCD_DATA<=8'h54; LCD_RW<=1'b0; LCD_RS<=1'b1; end 571: LCD_EN<=1'b1; 580: begin //定位到第一行 LCD_DATA<=8'h80; LCD_RW<=1'b0; LCD_RS<=1'b0; end 581: LCD_EN<=1'b1; 590: begin //write data L LCD_DATA<=8'h4C; LCD_RW<=1'b0; LCD_RS<=1'b1; end 591: LCD_EN<=1'b1; 600: begin //write data O LCD_DATA<=8'h4F; LCD_RW<=1'b0; LCD_RS<=1'b1; end 601: LCD_EN<=1'b1; 610: begin //write data V LCD_DATA<=8'h56; LCD_RW<=1'b0; LCD_RS<=1'b1; end 611: LCD_EN<=1'b1; 620: begin //write data E LCD_DATA<=8'h45; LCD_RW<=1'b0; LCD_RS<=1'b1; end 621: LCD_EN<=1'b1; 630: begin //write data ! LCD_DATA<=8'h21; LCD_RW<=1'b0; LCD_RS<=1'b1; end 631: LCD_EN<=1'b1; default: LCD_EN<=1'b0; endcase end endmodule ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: 1602
 输入关键字,在本站1000多万海量源码库中尽情搜索: