Altera_Forum
Honored Contributor
14 years agoDE1 VGA help!
So far i've got this - I've looked at sample code, but I'm kinda stuck atm
just won't work - any ideas? Thanks!! In verilog~ ///////////////////////////////////////////////////////////////////////////////// // VGA Controller ///////////////////////////////////////////////////////////////////////////////// always @(posedge CLOCK_50) begin if (count1 == 0) begin ledcounter = ledcounter+1; end count1 = count1+1; //divide by 2 = 25 MHz if (count == 1) begin count = 0; end else begin refreshHVGA(); refreshVVGA(); count = 1; end end // Horizontal // 96 Sync // 48 Back Porch // 640 Pixel // 16 Front Porch // 800 total task refreshHVGA; begin //Reset if (h_cnt == 800) begin h_cnt = 0; v_cnt = v_cnt+1; end if (h_cnt == 0) begin //Sync (96 cycles) vga_h_sync = 0; p_flag = 0; end else if (h_cnt == 96) begin //Back Porch B (48 cycles) vga_h_sync = 1; end else if(h_cnt == 144) begin //Display Interval C (640 cycles) if(v_flag) begin //RGB Row On //get from BMP file red = 255; green = 0; blue = 0; end end else if (h_cnt == 784) begin //Front Porch D (0.6 us) //set output to 0 red = 0; green = 0; blue = 0; end h_cnt = h_cnt+1; end endtask // Vertical // 2 Sync // 33 Front Porch // 480 Video Lines // 10 Back Porch // 525 Lines total task refreshVVGA; begin //Reset if (v_cnt == 525) begin v_cnt = 0; end if (v_cnt == 0) begin //Sync A (2 lines) vga_v_sync = 0; end else if (v_cnt == 2) begin //Back Porch B (33 lines) vga_v_sync = 1; end else if (v_cnt == 35) begin //Display Interval C (480 lines) //wait for horizontal to do it's job v_flag = 1; end else if (v_cnt == 515) begin //Front Porch D (10 lines) v_flag = 0; end end endtask endmodule