Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

NIOS II on DE0, displaying on LCD

Altera_Forum
Honored Contributor II
1,491 Views

Hi everyone, 

 

I am trying to get some message displayed on LCD using DE0 board.  

 

I had a look at the Pin Assignment tool and all pins are assigned correctly.  

 

All of the files included in .c file are within project directory.  

 

This is my main.c code:  

#include <stdio.h>#include "system.h"#include "altera_avalon_pio_regs.h"#include "altera_avalon_lcd_16207_regs.h"#include "altera_avalon_lcd_16207.h"int main(){ char ch = '\0'; FILE *lcd_d = 0; lcd_d = fopen(LCD_DISPLAY_NAME, "w"); printf("LCD & Keypad Test!\n"); //altera_avalon_lcd_16207_init(LCD_DISPLAY_BASE); printf("Address of LCD: %s\n", LCD_DISPLAY_NAME); while(1){ ch = kbd_getc(); usleep(9); if(ch != 0){ printf("%c ", ch); fprintf(lcd_d, "Hello LCD"); } } return (0); } 

 

The code here is from another topic: http://alteraforum.com/forum/showthread.php?t=32164 

 

When I try to rebuild the project I get errors: 

'LCD_DISPLAY NAME' undeclared  

and warnings: 

implicit declaration of function 'kdb_getc' 

implicit declaration of function 'usleep' 

 

Could someone please offer some advice how do I go about this problem?  

 

Are there specific commands that need to be used for DE0 board?  

 

Many thanks
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
360 Views

Take a look at your system.h file. It will have the a section for each device in the system. These are the definitions you need to use when referencing your peripherals.

0 Kudos
Altera_Forum
Honored Contributor II
360 Views

 

--- Quote Start ---  

Take a look at your system.h file. It will have the a section for each device in the system. These are the definitions you need to use when referencing your peripherals. 

--- Quote End ---  

 

 

For LCD it gives me the following: 

 

# define LCD_NAME "/dev/lcd" 

# define LCD_TYPE "altera_avalon_lcd_16207" 

# define LCD_BASE 0x00000090 

# define LCD_SPAN 16 

# define ALT_MODULE_CLASS_lcd altera_avalon_lcd_16207 

 

not sure how these could be used.
0 Kudos
Altera_Forum
Honored Contributor II
360 Views

Change LCD_DISPLAY_NAME to LCD_NAME in your code.

0 Kudos
Reply