MyFPGA Forum

标题: DE2_70 Hello World [打印本页]

作者: Frank    时间: 2009-4-20 00:12
标题: DE2_70 Hello World
功能: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. }
复制代码

作者: Frank    时间: 2009-4-20 00:14
图片怎么贴不上来呀?
作者: sharon_ho    时间: 2009-4-20 13:57
2# Frank


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

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

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

http://www.myfpga.org/discuz/faq ... =5&messageid=17
作者: Frank    时间: 2009-4-21 11:04
本帖最后由 Frank 于 2009-4-21 11:09 编辑

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

图二是DE2_70的Pin Location

作者: fanxingrong    时间: 2009-4-27 19:59
:$
作者: xlbian    时间: 2009-5-24 13:41
学习了!
作者: herman2    时间: 2010-3-3 08:52
Thanks for your sharing.
作者: 培培    时间: 2010-3-9 15:37
假如我现在不用函数hello_lcd();,只是在LCD上显示Hello from Nios II!,也就是说NiosII中的.c文件中的内容不动;
用SOPC建立的系统中加入一个Timer定时器,我想在LCD上循环显示Hello from Nios II!, 但是通过Quartusii和Niosii编译了下载到开发板上之后字符怎么不动呢?




欢迎光临 MyFPGA Forum (http://www.myfpga.org/discuz/) Powered by Discuz! X3