共8条
1/1 1 跳转至页
VGA800*600显示疑问(已解决)
时钟通过PLL倍频,是满足要求的。
/****************************************************************************** *Engineer: superdian *Create Date: 2014/9/29 *Design Name: *Module Name: VGA *Project Name: *Target Devices: EP3CE5E144C8 *Tool versions: *Description: * *Dependencies: * *Revision: *Revision 0.01 - File Created *Additional Comments: ******************************************************************************/ module VGA(clock,switch,disp_RGB,hsync,vsync); input clock;//系统输入时钟80MHZ input [1:0] switch; output [2:0] disp_RGB;//VGA数据输出 output hsync; //vga行同步信号 output vsync; //vga场同步信号 reg [10:0] hcount;//vga行扫描计数器 reg [10:0] vcount;//vga场扫描计数器 reg [2:0] data; reg [2:0] h_dat; reg [2:0] v_dat; reg flag; wire hcount_ov; wire vcount_ov; wire dat_act; wire hsync; wire vsync; reg vga_clk; //vga行场扫描时序参数表 parameter hsync_end = 11'd127, hdat_begin = 11'd215, hdat_end = 11'd1015, hpixel_end = 11'd1055, vsync_end = 11'd3, vdat_begin = 11'd26, vdat_end = 11'd626, vline_end = 11'd627; always @(posedge clock) begin vga_clk = ~vga_clk; end /**************************** VGA驱动部分 ****************************/ //行扫描 always@ (posedge vga_clk) begin if(hcount_ov) hcount <= 11'd0; else hcount <= hcount + 1'd1; end assign hcount_ov = (hcount == hpixel_end); //场扫描 always@(posedge vga_clk) begin if(hcount_ov) begin if(vcount_ov) vcount <= 11'd0; else vcount <= vcount + 1'd1; end end assign vcount_ov = (vcount == vline_end); //数据,信号同步传输 assign dat_act = ((hcount >= hdat_begin)&&(vcount <hdat_end)) &&((vcount >= vdat_begin) && (vcount < vdat_end)); assign hsync = (hcount > hsync_end); assign vsync = (vcount > vsync_end); assign disp_RGB = (dat_act) ? data:3'h00; always @(posedge vga_clk) begin case(switch[1:0]) 2'd0: data <= h_dat; //横彩条 2'd1: data <= v_dat; //选择竖彩条 2'd2: data <= (v_dat ^ h_dat); //异或产生棋盘格 2'd3: data <= (v_dat ~^ h_dat); //同或产生棋盘格 endcase end always @(posedge vga_clk)//产生竖彩条 begin if(hcount <315) v_dat <= 3'h7; //白 else if(hcount < 415) v_dat <= 3'h6; //黄 else if(hcount < 515) v_dat <= 3'h5; //青 else if(hcount < 615) v_dat <= 3'h4; //绿 else if(hcount < 715) v_dat <= 3'h3; //紫 else if(hcount < 815) v_dat <= 3'h2;//红 else if(hcount < 915) v_dat <= 3'h1; //蓝 else v_dat <= 3'h0; //黑 end always@(posedge vga_clk)//产生横彩条 begin if(vcount <101) h_dat <= 3'h7; //白 else if(vcount < 176) h_dat <= 3'h6; //黄 else if(vcount < 251) h_dat <= 3'h5; //青 else if(vcount < 326) h_dat <= 3'h4; //绿 else if(vcount < 401) h_dat <= 3'h3; //紫 else if(vcount < 476) h_dat <= 3'h2; //红 else if(vcount < 551) h_dat <= 3'h1; //蓝 else h_dat <= 3'h0; //黑 end endmodule
共8条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
【换取逻辑分析仪】自制底板并驱动ArduinoNanoRP2040ConnectLCD扩展板被打赏47分 | |
【分享评测,赢取加热台】RISC-V GCC 内嵌汇编使用被打赏38分 | |
【换取逻辑分析仪】-基于ADI单片机MAX78000的简易MP3音乐播放器被打赏48分 | |
我想要一部加热台+树莓派PICO驱动AHT10被打赏38分 | |
【换取逻辑分析仪】-硬件SPI驱动OLED屏幕被打赏36分 | |
换逻辑分析仪+上下拉与多路选择器被打赏29分 | |
Let'sdo第3期任务合集被打赏50分 | |
换逻辑分析仪+Verilog三态门被打赏27分 | |
换逻辑分析仪+Verilog多输出门被打赏24分 | |
【分享评测,赢取加热台】使用8051单片机驱动WS2812被打赏40分 |