MyFPGA Forum

 找回密码
 注册
搜索
查看: 5736|回复: 7
打印 上一主题 下一主题

DE2_70 Hello World

[复制链接]
跳转到指定楼层
1#
发表于 2009-4-20 00:12:58 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
功能:1、在LCD 上分两行显示 “DE2_70”和“Hello”
      2、在NiosII IDE的控制台上显示:“Hello from Nios II!”
C:\Documents and Settings\Frank\My Documents\My Pictures\1.jpg
硬件设计中的顶层文件MY_FIRST_SOPC.v如下:
  1. module MY_FIRST_SOPC
  2. (
  3.         ////////////////////        Clock Input                 ////////////////////         
  4.         iCLK_50,        // 50 MHz
  5.         ////////////////////        LCD Module 16X2                ////////////////
  6.         oLCD_ON,        // LCD Power ON/OFF
  7.         oLCD_BLON,        // LCD Back Light ON/OFF
  8.         oLCD_RW,        // LCD Read/Write Select, 0 = Write, 1 = Read
  9.         oLCD_EN,        // LCD Enable
  10.         oLCD_RS,        // LCD Command/Data Select, 0 = Command, 1 = Data
  11.         LCD_D,        // LCD Data bus 8 bits
  12. );
  13. // PORT declarations
  14. //==================================================
  15. ////////////////////////        Clock Input                 ////////////////////////
  16. input                        iCLK_50;        // 50 MHz
  17. ////////////////////        LCD Module 16X2        ////////////////////////////
  18. inout        [7:0]        LCD_D;         // LCD Data bus 8 bits
  19. output        oLCD_ON;         // LCD Power ON/OFF
  20. output        oLCD_BLON;         // LCD Back Light ON/OFF
  21. output        oLCD_RW;         // LCD Read/Write Select, 0 = Write, 1 = Read
  22. output        oLCD_EN;         // LCD Enable
  23. output        oLCD_RS;         // LCD Command/Data Select,
  24.                                         // 0 = Command, 1 = Data
  25. //==========        16*2 LCD Module
  26. assign oLCD_ON     = 1'b1;        // LCD ON
  27. assign oLCD_BLON        = 1'b1;        // LCD Back Light
  28. // Structural coding
  29. //==================================================
  30. DE2_70_SOPC u1 (
  31.                       // 1) global signals:
  32.                        .clk(iCLK_50),
  33.                        .reset_n(1),
  34.                       // the_lcd
  35.                        .LCD_E_from_the_lcd(oLCD_EN),
  36.                        .LCD_RS_from_the_lcd(oLCD_RS),
  37.                        .LCD_RW_from_the_lcd(oLCD_RW),
  38.                        .LCD_data_to_and_from_the_lcd(LCD_D)
  39. );
  40. endmodule
复制代码
锁定引脚:
C:\Documents and Settings\Frank\My Documents\My Pictures\2.png
然后compile/download
软件设计时,编写Hello_world.c
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include "system.h"

  5. void hello_lcd(void);

  6. int main()
  7. {
  8.   printf("Hello from Nios II!\n");

  9.   hello_lcd();
  10.    
  11.   return 0;
  12. }
  13. void hello_lcd(void){
  14.     FILE *pLCD;
  15.     char szHello[] = "DE2_70\nHello\n";
  16.    
  17.     pLCD = fopen(LCD_NAME, "w");
  18.     if (pLCD){
  19.         fwrite(szHello, strlen(szHello), 1, pLCD);
  20.         //fclose(pLCD);
  21.     }else{
  22.         printf("failed to open LCD\n");
  23.     }   
  24. }
复制代码
2#
 楼主| 发表于 2009-4-20 00:14:14 | 只看该作者
图片怎么贴不上来呀?
3#
发表于 2009-4-20 13:57:07 | 只看该作者
2# Frank


MyFPGA Forum » 帮助 » 我如何发表新主题

我如何实现发帖时图文混排效果[ 展开 ]

发表新主题的时候点击上传附件左侧的“[插入]”链接把附件标记插入到帖子中适当的位置即可。

http://www.myfpga.org/discuz/faq ... =5&messageid=17
4#
 楼主| 发表于 2009-4-21 11:04:59 | 只看该作者
本帖最后由 Frank 于 2009-4-21 11:09 编辑

将缺的两个图补上来。
图一是系统整体架构图

图二是DE2_70的Pin Location
5#
发表于 2009-4-27 19:59:18 | 只看该作者
:$
6#
发表于 2009-5-24 13:41:53 | 只看该作者
学习了!
7#
发表于 2010-3-3 08:52:58 | 只看该作者
Thanks for your sharing.
8#
发表于 2010-3-9 15:37:11 | 只看该作者
假如我现在不用函数hello_lcd();,只是在LCD上显示Hello from Nios II!,也就是说NiosII中的.c文件中的内容不动;
用SOPC建立的系统中加入一个Timer定时器,我想在LCD上循环显示Hello from Nios II!, 但是通过Quartusii和Niosii编译了下载到开发板上之后字符怎么不动呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|MyFPGA

GMT+8, 2024-5-6 02:39 , Processed in 0.045641 second(s), 18 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表