Robin Khosla
Member level 4
I want to interface camera c3088 with spartan-3
c3088 has Y(8-bit) output
i want to get this output on 8 LED's of FPGA
can u correct my following code
i am unable to do get the output on leds and confused in the i2c interface
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-------------------------------------------------
entity cam1 is
Port ( rst : in STD_LOGIC;
clk : in STD_LOGIC;
rw : in STD_LOGIC;
crst: out STD_LOGIC;
scl,sda:inout std_logic;
cam_pclk : in STD_LOGIC;
cam_href : in STD_LOGIC;
cam_vsync : in STD_LOGIC;
agnd1 : out STD_LOGIC;
agnd2 : out STD_LOGIC;
agnd3 : out STD_LOGIC;
gnd1 : out STD_LOGIC;
vcc1 : out STD_LOGIC;
vcc2 : out STD_LOGIC;
cam_y : in STD_LOGIC_VECTOR (7 downto 0);
cam_o : out STD_LOGIC_VECTOR (7 downto 0));
end cam1;
-------------------------------------------------
architecture cam2 of cam1 is
signal crst1:std_logic;
signal i:integer:=13;
signal count: std_logic_vector(25 downto 0);
signal data: std_logic_vector(12 downto 0):="0000110000011"; -- c1 for read
begin
process (rst,clk,rw,cam_vsync,cam_href,cam_pclk)
begin
if (rst='1') then
cam_o <= (others => '0');
elsif (clk'event and clk='1') then
count<= count+1;
if (cam_vsync='0' and rw='0') then
if (cam_href='1' and cam_pclk='0') then
cam_o <= cam_y;
end if;
end if;
agnd1<='0';
agnd2<='0';
agnd3<='0';
gnd1<='0';
vcc1<='1';
vcc2<='1';
crst1<='1';
crst1<= not crst1 after 100 us;
crst<= crst1;
end if;
end process;
scl<= count(25);
process(scl,sda)
begin
if (scl'event and scl='1') then
if (i<=13) then
sda <= data(i);
i <= i - 1;
end if;
end if;
end process;
end cam2;
the datasheet of c3088 and ov6620 are also attached
c3088 has Y(8-bit) output
i want to get this output on 8 LED's of FPGA
can u correct my following code
i am unable to do get the output on leds and confused in the i2c interface
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-------------------------------------------------
entity cam1 is
Port ( rst : in STD_LOGIC;
clk : in STD_LOGIC;
rw : in STD_LOGIC;
crst: out STD_LOGIC;
scl,sda:inout std_logic;
cam_pclk : in STD_LOGIC;
cam_href : in STD_LOGIC;
cam_vsync : in STD_LOGIC;
agnd1 : out STD_LOGIC;
agnd2 : out STD_LOGIC;
agnd3 : out STD_LOGIC;
gnd1 : out STD_LOGIC;
vcc1 : out STD_LOGIC;
vcc2 : out STD_LOGIC;
cam_y : in STD_LOGIC_VECTOR (7 downto 0);
cam_o : out STD_LOGIC_VECTOR (7 downto 0));
end cam1;
-------------------------------------------------
architecture cam2 of cam1 is
signal crst1:std_logic;
signal i:integer:=13;
signal count: std_logic_vector(25 downto 0);
signal data: std_logic_vector(12 downto 0):="0000110000011"; -- c1 for read
begin
process (rst,clk,rw,cam_vsync,cam_href,cam_pclk)
begin
if (rst='1') then
cam_o <= (others => '0');
elsif (clk'event and clk='1') then
count<= count+1;
if (cam_vsync='0' and rw='0') then
if (cam_href='1' and cam_pclk='0') then
cam_o <= cam_y;
end if;
end if;
agnd1<='0';
agnd2<='0';
agnd3<='0';
gnd1<='0';
vcc1<='1';
vcc2<='1';
crst1<='1';
crst1<= not crst1 after 100 us;
crst<= crst1;
end if;
end process;
scl<= count(25);
process(scl,sda)
begin
if (scl'event and scl='1') then
if (i<=13) then
sda <= data(i);
i <= i - 1;
end if;
end if;
end process;
end cam2;
the datasheet of c3088 and ov6620 are also attached