有人玩过 ov7670吗 那个 ov7670的PCLK和XCLK是什么关系?两个时钟一样的吗?
时间:10-02
整理:3721RD
点击:
最近看了一段例程,关于ov7670摄像头显示的。他里面 PCLK是摄像头输出程序的时钟,用来作为采集图像数据的时钟;然后程序又定义了 28mhz的XCLK时钟通过接线输出给ov7670摄像头。我想知道这个XCLK是不是等于PCLK? 也就是说程序定义了28mhz的时钟给XCLK,然后XCLK=PCLK,PCLK时钟控制图像数据的采集?是不是这样 ?求解释?
`timescale 1ns/1ns
module CMOS_Capture
(
//Global Clock
input iCLK, //28MHz
input iRST_N,
//I2C Initilize Done
input Init_Done, //Init Done
//Sensor Interface 传感器接口
output CMOS_RST_N, //cmos work state(5ms delay for sccb config)
output CMOS_PWDN, //cmos power on
output CMOS_XCLK, //28MHz 一般是24mhz 因为图像是800X480
input CMOS_PCLK, //28MHz 数据采集时钟
input [7:0] CMOS_iDATA, //CMOS Data
input CMOS_VSYNC, //L: Vaild
input CMOS_HREF, //H: Vaild
// output Frame_valid_r;
//Ouput Sensor Data
output reg CMOS_oCLK, //1/2 PCLK
output reg [15:0] CMOS_oDATA, //16Bits RGB
output reg CMOS_VALID, //Data Enable
output reg [7:0] CMOS_FPS_DATA //cmos fps 每秒帧数
);
assign CMOS_RST_N = 1'b1; //cmos work state(5ms delay for sccb config)
assign CMOS_PWDN = 1'b0; //cmos power on
assign CMOS_XCLK = iCLK; //28MHz XCLK
//----------------------------------------------
reg mCMOS_VSYNC;
always@(posedge CMOS_PCLK or negedge iRST_N)
begin
if(!iRST_N)
mCMOS_VSYNC = 12'd1 && X_Cont <= H_DISP))
CMOS_oCLK <= ~CMOS_oCLK;
else
CMOS_oCLK <= 0;
end
//----------------------------------------------------
//数据输出有效 CMOS_VALID
always@(posedge CMOS_PCLK or negedge iRST_N)
begin
if(!iRST_N)
CMOS_VALID <= 0;
else if(Frame_valid == 1'b1)
CMOS_VALID <= ~CMOS_VSYNC;
else
CMOS_VALID <= 0;
end
endmodule
`timescale 1ns/1ns
module CMOS_Capture
(
//Global Clock
input iCLK, //28MHz
input iRST_N,
//I2C Initilize Done
input Init_Done, //Init Done
//Sensor Interface 传感器接口
output CMOS_RST_N, //cmos work state(5ms delay for sccb config)
output CMOS_PWDN, //cmos power on
output CMOS_XCLK, //28MHz 一般是24mhz 因为图像是800X480
input CMOS_PCLK, //28MHz 数据采集时钟
input [7:0] CMOS_iDATA, //CMOS Data
input CMOS_VSYNC, //L: Vaild
input CMOS_HREF, //H: Vaild
// output Frame_valid_r;
//Ouput Sensor Data
output reg CMOS_oCLK, //1/2 PCLK
output reg [15:0] CMOS_oDATA, //16Bits RGB
output reg CMOS_VALID, //Data Enable
output reg [7:0] CMOS_FPS_DATA //cmos fps 每秒帧数
);
assign CMOS_RST_N = 1'b1; //cmos work state(5ms delay for sccb config)
assign CMOS_PWDN = 1'b0; //cmos power on
assign CMOS_XCLK = iCLK; //28MHz XCLK
//----------------------------------------------
reg mCMOS_VSYNC;
always@(posedge CMOS_PCLK or negedge iRST_N)
begin
if(!iRST_N)
mCMOS_VSYNC = 12'd1 && X_Cont <= H_DISP))
CMOS_oCLK <= ~CMOS_oCLK;
else
CMOS_oCLK <= 0;
end
//----------------------------------------------------
//数据输出有效 CMOS_VALID
always@(posedge CMOS_PCLK or negedge iRST_N)
begin
if(!iRST_N)
CMOS_VALID <= 0;
else if(Frame_valid == 1'b1)
CMOS_VALID <= ~CMOS_VSYNC;
else
CMOS_VALID <= 0;
end
endmodule
PCLK是像素时钟输出,XCLK是主时钟输入