Forum Discussion
Altera_Forum
Honored Contributor
19 years agoImplementing VGA display in Nios II Project
Hey everyone,
I am trying to find a good place to start to display images on a VGA monitor from my DE1 Altera board with a Cyclone II processor. Does anyone know of any good reference design projects or documentation for doing this or where to get started? Have an SOPC system built and programmed with a VGA controller included. All prep work is done I am at the point where I am ready to get into code in Nios II. Also, as another question does anyone know how to load a bitmap into SRAM because I am under the assumption that once loaded into SRAM I can display to the monitor and that whatever I want to be displayed must reside in the SRAM. Is this a fair assumption? Thanks a lot!1 Reply
- Altera_Forum
Honored Contributor
Sure... Here's a quick Perl script that reads your bitmap image and creates a C char array from it:
=====
===== You could do this is most any language.... modify at will. Cheers, - slacker#!/bin/env perl $file = $ARGV; open(INPUT, "$file") || die "Failed to open input file!!! Cannot convert!!!"; open(OUTPUT, "> ext_flash.h" ); # # Output the variable declaration and set an attribute on it.# print(OUTPUT "unsigned char __attribute__ ((aligned(4))) data_buf = {\n"); $i = 0; while(read(INPUT, $data, 1)) { if($i == 0) { print(OUTPUT "\t"); } # # Here's the magic... use unpack to grab the file's data into an unsigned # char variable. # printf(OUTPUT "%#02x, ", unpack("C", $data)); $i++; if($i == 10) { print(OUTPUT "\n"); $i = 0; } } print(OUTPUT "};\n\n"); close(FILE);