基于Verilog的VGA驱动设计1时序分析

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

基于Verilog的VGA驱动设计(一)VGA时序分析

VGA时序分析

电阻DAC转换网络和640X480的VGA时序图:

1

扫描频率

显示器采用光栅扫描方式,即轰击荧光屏的电子束在CRT屏幕上从左到右(受水平同步信号HSYNC控制)、从上到下(受垂直同步信号VSYNC控制)做有规律的移动。光栅扫描又分逐行扫描和隔行扫描。电子束采用光栅扫描方式,从屏幕左上角一点开始,向右逐点进行扫描,形成一条水平线;到达最右端后,又回到下一条水平线的左端,重复上面的过程;当电子束完成右下角一点的扫描后,形成一帧。此后,电子束又回到左上方起点,开始下一帧的扫描。这种方法也就是常说的逐行扫描显示。

Horizonal Timing

图2

A (us) Line Period

B (us) Sync pulse lenght

C (us) Back porch

D (us) Active video time

E (us) Front porch

Vertical Timing

图3

O (ms) Frame Period

P (ms) Sync length

Q (ms) Back porch

R (ms) Active video time

S (ms) Front porch

Horizonal timing information 水平扫描时序

图4

Notes:

∙Active area is actually an active area added with 6 overscan border pixels (in some other VGA timing tables those border pixels are included in back and front porch)

Vertical timing information 垂直扫描时序

图5

Notes:

∙Active area is actually an active area added with 4 overscan border lines (in some other VGA timing tables those border lines are included in back and front porch)

Note than when the active part of VGA page is widened, it passes by the rising edge of the vertical sync signal in some modes (marked with *)

根据上面的水平和垂直扫描时序可以分析显示800x600模式,FPGA系统时钟采用Spartan-3E Starter Kit板上的50MHz的有源晶振。为了显示器显示效果好,采用刷新频率为72Hz。

以下以系统时钟频率为50MHz,显示器显示800x600模式为例分析水平扫描和垂直扫描时序:系统时钟周期为1/50MHz=20ns

水平扫描Horizonal(Line)

A 水平(行)周期为1040个像素(Pix),时间为1040x20ns=20.8us;

B 同步脉冲为120像素(Pix);

C 后沿为61个像素(Pix);

D 有效时间为806个像素(Pix);

E 前沿为53个像素。

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////// 水平扫描参数的设定

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// parameter LinePeriod =12'd1040;

parameter H_SyncPulse=10'd120;

parameter H_BackPorch=10'd61;

parameter H_ActivePix=10'd806;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////// 水平扫描计数

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// always @ (posedge clk or negedge rst_n)

if(!rst_n) x_cnt <= 1;

else if(x_cnt == LinePeriod) x_cnt <= 1;

else x_cnt <= x_cnt+ 1;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////// 水平扫描信号hsync产生

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// always @ (posedge clk or negedge rst_n)

if(!rst_n) hsync_r <= 1'b1;

else if(x_cnt == 1) hsync_r <= 1'b0; //产生hsync信号

else if(x_cnt == H_SyncPulse) hsync_r <= 1'b1;

相关文档
最新文档