怪异的自定义VGA信号行为(FPGA)

发布于 2025-02-06 08:43:19 字数 2205 浏览 4 评论 0原文

我的目标是用640x480px的分辨率在VGA显示器上显示一些内容。由于其他原因,我真的很想坚持此决议,但是我们会看到。

问题

有些线条显得调暗,有些看起来更轻,左侧还有一个大的黑色边框。我很确定这不是(纯粹是)由于我的“信号时机不良”。 (请忽略白色划痕)

我的设置

  • Altera Cyclone IV FPGA
  • 3x330 OHM电阻(在R,G,B线上)(我正在使用3V3直接驾驶Vsync和Hsync)
  • 。 MultiSync EA232WMi (

verilog code

module vga_test (
    output wire HSYNC,
    output wire VSYNC,
    output wire enable,
    output wire r,
    output wire g,
    output wire b,
    // 50 MHz at clk
    input wire clk
    );
    
    reg [32:0] hor_counter;
    reg [32:0] ver_counter;
 
    reg [32:0] counter;
 
    always @(posedge clk) begin
        counter <= counter + 1;
 
            if (enable == 1) begin
                    if (hor_counter[2:0] == 3) begin
                        g <= 1;
                    end else begin
                        g <= 0;
                    end
            end
 
            // Vertical counter
            if (hor_counter == 1271) begin
                enable <= 0;
            end if (hor_counter == 1303) begin
                HSYNC <= 0;
            end if (hor_counter == 1494) begin
                HSYNC <= 1;
            end    
 
            hor_counter <= hor_counter + 1;
 
            if (hor_counter == 1589) begin
            // if (hor_counter == 800) begin
                hor_counter <= 0;
                ver_counter <= ver_counter + 1;
                g <= 0;
 
                if (ver_counter <= 480) begin
                    enable <= 1;                end
 
            end
 
 
        // Horizontal counter
        if (ver_counter == 490) begin
            VSYNC <= 0;
        end if (ver_counter == 492) begin
            VSYNC <= 1;
        end
 
        if (ver_counter == 525) begin
            ver_counter <= 0;
        end
 
    end
 
endmodule

有趣的是,监视器没有将其选择为640x480,但是作为720x480 。 This would maybe solve the why there is the black border, but the

My goal is to display something on a VGA display with the resolution of 640x480px. I really want to stick with this resolution for other reasons, but we will see.

The problem:

Some lines appear dimmer and some appear lighter, also there is a large black border on the left side. I'm pretty sure that this is not (purely) due to my "bad signal timing" though.
(Please ignore the white scratch)
Picture of the display

My setup:

  • Altera Cyclone IV FPGA
  • 3x330 Ohm resistors (on R,G,B lines) (and I'm driving the VSYNC and HSYNC directly with 3V3)
  • Monitor NEC MultiSync EA232WMi (manual)

Verilog code:

module vga_test (
    output wire HSYNC,
    output wire VSYNC,
    output wire enable,
    output wire r,
    output wire g,
    output wire b,
    // 50 MHz at clk
    input wire clk
    );
    
    reg [32:0] hor_counter;
    reg [32:0] ver_counter;
 
    reg [32:0] counter;
 
    always @(posedge clk) begin
        counter <= counter + 1;
 
            if (enable == 1) begin
                    if (hor_counter[2:0] == 3) begin
                        g <= 1;
                    end else begin
                        g <= 0;
                    end
            end
 
            // Vertical counter
            if (hor_counter == 1271) begin
                enable <= 0;
            end if (hor_counter == 1303) begin
                HSYNC <= 0;
            end if (hor_counter == 1494) begin
                HSYNC <= 1;
            end    
 
            hor_counter <= hor_counter + 1;
 
            if (hor_counter == 1589) begin
            // if (hor_counter == 800) begin
                hor_counter <= 0;
                ver_counter <= ver_counter + 1;
                g <= 0;
 
                if (ver_counter <= 480) begin
                    enable <= 1;                end
 
            end
 
 
        // Horizontal counter
        if (ver_counter == 490) begin
            VSYNC <= 0;
        end if (ver_counter == 492) begin
            VSYNC <= 1;
        end
 
        if (ver_counter == 525) begin
            ver_counter <= 0;
        end
 
    end
 
endmodule

What is very interesting, is that the monitor did not pick this up as 640x480, but as 720x480. This would maybe solve the why there is the black border, but the user manual says that 640x480 is supported. And this is not just with this monitor, I tried some other I have on hand with similar results. Maybe there is something with the signal timing that I'm not getting? I would't be surprised if the "picture" looked stretched, similar to this post, but this looks like a sinusoidal pattern.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

森末i 2025-02-13 08:43:20

您的代码输出一个大型水平前廊。您的显示屏显示一个大型的水平前廊。

尝试将Hsync信号移动到末端。

Your code outputs a big horizontal front porch. Your display shows a big horizontal front porch.

Try moving the hsync signal closer to the end.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文