黑白CMOS图像传感器OV9120的原理及应用
实现采集的软件设计可在MAX+plusII环境中实现。软件设计的主要工作是CPLD对OV9120的配置。在开始充电时,首先对系统进行初始化。CPLD的全局时钟可用24MHz的晶振电路产生。配置时首先配置SCCB,配置完毕后将SCCE置1。当接收到DSP的开始采集信号后,根据同步信号的状态来判定是否开始采集数据,采集数据的同时可将数据送往SRAM。当DSP接收到CPLD的读取信号后,即可开始读取数据,并在DSP中完成图像的处理。采集处理的部分主程序如下:
reset2:process(reset_i,n1,clk)
begin
if reset_i=‘0’then scce_p<=‘1’;
else
if(n1=‘1’ or m1=‘1’)then
scce_p<=‘1’;
else scce p<=‘0’;
end if;
end if;
end process reset2;
clk1: process(n1,clk)
variable a: integer range 254 to 0;
begin
if(sio_c_start=‘0’ OR n1=‘1’) then
q<=‘1’;a:=0;
else
if(clk'event and clk=‘1’) then
if(sio_c start=‘1’ and n1=‘0’) then
if a<254 then; a:=a+1;
else a:=1;
end if;
if a<127 then q<=‘0’;
else q<=‘1’; end if;
end if;
end if;
end if;
end process clk1;
lock:process(sio_c_start,q)
variable n: integer range 8 to 0;
begin
if( sio_c_start=‘0’ then load<=‘1’;n:=0;
else
if (q 'event and q=‘0’) then
if n<8 then n?=n+1;
load<=‘0’;
else n:=0;load<=‘1’;
《黑白CMOS图像传感器OV9120的原理及应用(第3页)》