-
基于
Verilog
的
VGA
驱动设计(一)
VGA
时序分析
VGA
时序分析
电阻
DAC
转换网络和
640X4
80
的
VGA
时序图
< br>:
图
1
扫描频率
显示器采用
光栅扫描
方式,即
轰击荧光
屏的电子束
在
CRT
屏幕上从左到右<
/p>
(受水平同步信号
HSYNC
控制)、从
上到下(受垂直同步信号
VSYNC
控制)
做有规律的移动。
光栅扫描又分
逐行扫描
< br>和
隔行扫描
。
电子束采用光栅扫
描方式,
从屏幕左上角一点开始,向右逐点进行扫描,形成一条水平线;到达最右端后,
又回到下一条水平线的左端,
重复上面的过程;
当电子束完成右下角一点的扫描
后,
形成一帧
。
此后,电子束又回到左上方起点,开始下一帧的扫描。这种方法
也就是常说的逐行扫描显示。
nal Timing
图
2
A
(us) Line Period(1040*20ns)
B (us) Sync pulse lenght
C (us) Back porch
D (us) Active video time
E (us) Front porch
2
.
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
板上的
50
MHz
的有源晶振。
为了显示器显示效
果好,采用刷新频率为
72Hz
。
<
/p>
以下以系统时钟频率为
50MHz
,
p>
显示器显示
800x600
模式为例分析水
平扫
描和垂直扫描时序:系统时钟周期为
1/50MHz=
p>
20ns
水平扫描
Horizonal(Line)
A
水平(行)周期为
1040
个像素
(Pix)
,时间为
1040x20ns=20.8us
;
B
同步脉冲为
120
p>
像素(
Pix
);
C
后沿为
61
个像素
(Pix)
;(
66
)
D
有效时间为<
/p>
806
个像素
(Pix)
;(
800
)
E
前沿为
53
个像素。(
54
)
//////////////////////////////////////////////
//////////////////////////////////////////////////
////////////////////////////
//////////
水平扫描参数的设定
///////
//////////////////////////////////////////////////
//////////////////////////////////////////////////
/////////////////
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
产生
< br>
///////////////////////////////////
//////////////////////////////////////////////////
///////////////////////////////////////
always
@
(
posedge
clk or
negedge
rst_n)
if
(!rst_n)
hsync_r <= 1'b1;
else if
(x_cnt == 1) hsync_r
<= 1'b0;
//
产生
hs
ync
信号
else if
(x_cnt ==
H_SyncPulse) hsync_r <= 1'b1;
垂直扫描
Vertical(Fr
ame)
O
垂直扫描周期为
666
个行扫描,时间为
666x1040x20ns=13853us
;
P
同步脉冲为<
/p>
6
个行扫描,时间为
6x1040x20
ns=125us
;
-
-
-
-
-
-
-
-
-
上一篇:三年级下册科技活动教案
下一篇:34个鸡蛋阅读答案