Forum Discussion
Altera_Forum
Honored Contributor
16 years agoI use the following code for Cyclone II. I suppose should be the same for Cyclone III using HAL.
Hope it helps. # include <stdio.h> # include "system.h" ///// LCD control: ////////////////////////////////////////////////////// // From: http://www.altera.com/support/examples/nios2/exm-micro_mutex.html // ESC sequences: // From: http://www.isthe.com/chongo/tech/comp/ansi_escapes.html // ESC[#;#H Moves the cursor to line# , column# // ESC[2J Clear screen and home cursor // ESC[K Clear to end of line # define ESC_TOP_LEFT "[1;0H" # define ESC_BOTTOM_LEFT "[2;0H" # define LCD_CLR "[2J" # define LCD_CLR_LINE "[K" static unsigned char ESC = 0x1b; // Integer ASCII value of the ESC character void LCD_hello(void) { FILE* LCD; LCD = fopen ("/dev/lcd", "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); }