共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网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
【笔记】生成报错synthdesignERROR被打赏50分 | |
【STM32H7S78-DK评测】LTDC+DMA2D驱动RGBLCD屏幕被打赏50分 | |
【STM32H7S78-DK评测】Coremark基准测试被打赏50分 | |
【STM32H7S78-DK评测】浮点数计算性能测试被打赏50分 | |
【STM32H7S78-DK评测】Execute in place(XIP)模式学习笔记被打赏50分 | |
每周了解几个硬件知识+buckboost电路(五)被打赏10分 | |
【换取逻辑分析仪】RA8 PMU 模块功能寄存器功能说明被打赏20分 | |
野火启明6M5适配SPI被打赏20分 | |
NUCLEO-U083RC学习历程2-串口输出测试被打赏20分 | |
【笔记】STM32CUBEIDE的Noruletomaketarget编译问题被打赏50分 |