Altera_Forum
Honored Contributor
16 years agoNot able to display on NIOS II dev kit
Hi,
I have a NOIS II developpement Kit. I have open the mandelbrot demo. then re-generate the system with SOPC builder (I dont'know why there was not generated). I load the board with the .sof. I have write this program with NIOS IDE : (it should draw a blue screen with the text "hello world" on the lcd screen) # include <stdio.h># include <io.h># include "system.h"# include "altera_avalon_pio_regs.h"# include <stdlib.h> # include "alt_video_display.h"# include "alt_tpo_lcd.h"# include "altera_avalon_sgdma.h"# include "altera_avalon_sgdma_descriptor.h"# include "alt_tpo_lcd.h"# include "simple_graphics.h" static void drawMenuBackground(int horiz_start, int vert_start, int horiz_end, int vert_end, alt_video_display * display) { unsigned int colour; unsigned int red, green, blue; float increment; unsigned int counter = 0; blue = 0xFF; red = 0; green = 0; increment = 255 / ((float)(vert_end - vert_start)); while (vert_start <= vert_end) { colour = (red<<16) | (green<<8) | blue; vid_draw_line(horiz_start, vert_start, horiz_end, vert_start, 1, colour, display); counter++; red = (unsigned int)(increment * counter); green = (unsigned int)(increment * counter); vert_start++; } } void rotate_frame_buffers(alt_video_display * display) { while(alt_video_display_buffer_is_available(display) != 0) { } alt_video_display_register_written_buffer(display); } int main() { alt_tpo_lcd s_lcd; alt_tpo_lcd *lcd = &s_lcd; int result; alt_video_display * display; lcd->scen_pio = LCD_I2C_CS_BASE; lcd->scl_pio = LCD_I2C_SCL_BASE; lcd->sda_pio = LCD_I2C_DAT_BASE; display = alt_video_display_init( LCD_SGDMA_NAME, 800, 480, 32, ALT_VIDEO_DISPLAY_USE_HEAP, ALT_VIDEO_DISPLAY_USE_HEAP, 2); result = alt_tpo_lcd_init(lcd, 800, 480); if(!result) { printf("LCD control registers initilized\n"); } else { printf("LCD control register initialization failed\n"); } char Text[] = "Hello world"; drawMenuBackground(0, 0, 799, 479, display); vid_print_string_alpha(130, 50, RED_24, CLEAR_BACKGROUND, timesnewroman_24, display, Text); rotate_frame_buffers(display); return 0; } All is compiled and loaded successfully to the board but nothing works and I don't know why !! If someone can help