
共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电子工程师创研计划】技术变现通道已开启~ | |
发原创文章 【每月瓜分千元赏金 凭实力攒钱买好礼~】 | |
【EEPW在线】E起听工程师的声音! | |
“我踩过的那些坑”主题活动——第001期 | |
高校联络员开始招募啦!有惊喜!! | |
【工程师专属福利】每天30秒,积分轻松拿!EEPW宠粉打卡计划启动! | |
送您一块开发板,2025年“我要开发板活动”又开始了! | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
【我踩过的那些坑】calloc和malloc错误使用导致跑飞问题排查被打赏50分 | |
多组DCTODC电源方案被打赏50分 | |
【我踩过的那些坑】STM32cubeMX软件的使用过程中的“坑”被打赏50分 | |
新手必看!C语言精华知识:表驱动法被打赏50分 | |
【我踩过的那些坑】杜绑线问题被打赏50分 | |
【我踩过的那些坑】STM32的硬件通讯调试过程的“坑”被打赏50分 | |
【我踩过的那些坑】晶振使用的问题被打赏100分 | |
【我踩过的那些坑】电感选型错误导致的处理器连接不上被打赏50分 | |
【我踩过的那些坑】工作那些年踩过的记忆深刻的坑被打赏10分 | |
【我踩过的那些坑】DRC使用位置错误导致的问题被打赏100分 |