Frank 发表于 2009-4-20 00:12:58

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如下:module MY_FIRST_SOPC
(
        ////////////////////        Clock Input               ////////////////////       
        iCLK_50,        // 50 MHz
        ////////////////////        LCD Module 16X2                ////////////////
        oLCD_ON,        // LCD Power ON/OFF
        oLCD_BLON,        // LCD Back Light ON/OFF
        oLCD_RW,        // LCD Read/Write Select, 0 = Write, 1 = Read
        oLCD_EN,        // LCD Enable
        oLCD_RS,        // LCD Command/Data Select, 0 = Command, 1 = Data
        LCD_D,        // LCD Data bus 8 bits
);
// PORT declarations
//==================================================
////////////////////////        Clock Input               ////////////////////////
input                        iCLK_50;        // 50 MHz
////////////////////        LCD Module 16X2        ////////////////////////////
inout                LCD_D;       // LCD Data bus 8 bits
output        oLCD_ON;       // LCD Power ON/OFF
output        oLCD_BLON;       // LCD Back Light ON/OFF
output        oLCD_RW;       // LCD Read/Write Select, 0 = Write, 1 = Read
output        oLCD_EN;       // LCD Enable
output        oLCD_RS;       // LCD Command/Data Select,
                                        // 0 = Command, 1 = Data
//==========        16*2 LCD Module
assign oLCD_ON   = 1'b1;        // LCD ON
assign oLCD_BLON        = 1'b1;        // LCD Back Light
// Structural coding
//==================================================
DE2_70_SOPC u1 (
                      // 1) global signals:
                     .clk(iCLK_50),
                     .reset_n(1),
                      // the_lcd
                     .LCD_E_from_the_lcd(oLCD_EN),
                     .LCD_RS_from_the_lcd(oLCD_RS),
                     .LCD_RW_from_the_lcd(oLCD_RW),
                     .LCD_data_to_and_from_the_lcd(LCD_D)
);
endmodule
锁定引脚:
C:\Documents and Settings\Frank\My Documents\My Pictures\2.png
然后compile/download
软件设计时,编写Hello_world.c#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "system.h"

void hello_lcd(void);

int main()
{
printf("Hello from Nios II!\n");

hello_lcd();
   
return 0;
}
void hello_lcd(void){
    FILE *pLCD;
    char szHello[] = "DE2_70\nHello\n";
   
    pLCD = fopen(LCD_NAME, "w");
    if (pLCD){
      fwrite(szHello, strlen(szHello), 1, pLCD);
      //fclose(pLCD);
    }else{
      printf("failed to open LCD\n");
    }   
}

Frank 发表于 2009-4-20 00:14:14

图片怎么贴不上来呀?:(

sharon_ho 发表于 2009-4-20 13:57:07

2# Frank


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

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

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

http://www.myfpga.org/discuz/faq.php?action=faq&id=5&messageid=17

Frank 发表于 2009-4-21 11:04:59

本帖最后由 Frank 于 2009-4-21 11:09 编辑

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

图二是DE2_70的Pin Location

fanxingrong 发表于 2009-4-27 19:59:18

:time::(:$

xlbian 发表于 2009-5-24 13:41:53

学习了!

herman2 发表于 2010-3-3 08:52:58

Thanks for your sharing.

培培 发表于 2010-3-9 15:37:11

假如我现在不用函数hello_lcd();,只是在LCD上显示Hello from Nios II!,也就是说NiosII中的.c文件中的内容不动;
用SOPC建立的系统中加入一个Timer定时器,我想在LCD上循环显示Hello from Nios II!, 但是通过Quartusii和Niosii编译了下载到开发板上之后字符怎么不动呢?
页: [1]
查看完整版本: DE2_70 Hello World