All: I have gotten the LCD working correctly using fprintf; but it appears as though I have found a "bug"
Here is some test code based on the Hello_World reference
#include <stdio.h># include "system.h"
int main()
{
FILE *fp_LCD=0;
printf("Hello from Nios II!\n");
fp_LCD = fopen(LCD_DISPLAY_NAME,"w"); // open LCD for write
if(fp_LCD==0)
printf("\nError Opening %s\n\n",LCD_DISPLAY_NAME);
else
{
printf("LCD opened, ready for access\n");
fprintf(fp_LCD,"This message should scroll across the screen... ");
}
return 0;
}
After compiling and downloading, the code appeared on the LCD, displaying the first 16 characters. Kind of made sense until I looked through the lcd HAL driver and see that the text should scroll.
I won't get into details, but I played around with the code for hours, comparing to the count_binary.c reference design which works.
I came across this:
The alt_sys_init.c file that gets created for my hello_world is slightly different than the count_binary.c, not suprising really, but check this out:
void alt_sys_init( void )
{
//ALTERA_AVALON_LCD_16207_INIT( LCD_DISPLAY, lcd_display );
ALTERA_AVALON_DMA_INIT( DMA, dma );
ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INIT( EPCS_CONTROLLER, epcs_controller );
ALTERA_AVALON_CFI_FLASH_INIT( EXT_FLASH, ext_flash );
ALTERA_AVALON_TIMER_INIT( SYS_CLK_TIMER, sys_clk_timer );
ALTERA_AVALON_TIMER_INIT( HIGH_RES_TIMER, high_res_timer );
ALTERA_AVALON_JTAG_UART_INIT( JTAG_UART, jtag_uart );
ALTERA_AVALON_LAN91C111_INIT( LAN91C111, lan91c111 );
ALTERA_AVALON_SYSID_INIT( SYSID, sysid );
ALTERA_AVALON_UART_INIT( UART1, uart1 );
ALTERA_AVALON_LCD_16207_INIT( LCD_DISPLAY, lcd_display );
}
By default, the first line is enabled and the last line doesn't exist. This doesn't scroll the text.
By commenting out the first line and moving the driver initilization to the end (as shown), the text scrolls!!!
I haven't gone through the trouble of seeing which driver is interferring with the LCD, but I thought you may be interested!
Regards,
-Terry