Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

ERROR in Character LCD Cyclone III dev kit

I have a SOPC set up with a CPU Processor, On-Chip memory, JTAG UART, and Character LCD. The clock is 50 Mhz.

LCD_E_from_the_lcd_0 --> lcd_en [PIN_AC24] (set OUTPUT)

LCD_RS_from_the_lcd_0 --> lcd_d_cn [PIN_D27] (set OUTPUT)

LCD_RW_from_the_lcd_0 --> lcd_wen [PIN_AC4] (set OUTPUT)

LCD_data --> lcd_data[7..0] (set INOUT)

I do NOT have "Reduced device drivers" checked, because the LCD drivers do not provide small drivers.

My code in NIOS II is :

#include <stdio.h>

#include <system.h>

#define ESC_TOP_LEFT "[1;0H"

#define ESC_BOTTOM_LEFT "[2;0H"

#define LCD_CLR "[2J"

#define LCD_CLR_LINE "[K"

static unsignedchar ESC = 0x1b;

void lcd_hello(void)

{

FILE* LCD;

LCD = fopen (LCD_0_NAME, "w");

if(LCD == NULL) {

printf("LCD open failed\n");

}

else {

printf("LCD open succeeded\n");

fprintf(LCD, "%c%s", ESC, LCD_CLR); // Clears LCD

fprintf(LCD, "LCD demo using\n");

fprintf(LCD, "altera HAL in C");

}

fclose(LCD);

}

int main (void){

LCD_hello();

while(1);

return 0;

}

Is my code wrong? My kit (LCD) does't work. Thank u

No RepliesBe the first to reply