Hello
i want to make a simple - very simple communication between my FPGA(SPRATAN XC2S300E) and ADC - MAX1037. Therefore i've made such a code:
...
signal frame : STD_LOGIC_VECTOR (9 downto 0);
signal shiftCounter : STD_LOGIC_VECTOR (3 downto 0) :="0000";
signal ADCAdressWR : std_logic_vector (7 downto 0) := "00010011";
signal ADCAdressRD : std_logic_vector (7 downto 0) := "10010011"; signal ADCConfiguration: std_logic_vector (7 downto 0) ;
signal ADCSetup : std_logic_vector (7 downto 0) := "00000001";
...
process(SCL)
begin
frame(0) <= '0'; --uart start bit
frame(9) <= '1';
if rising_edge(SCL) then
for i in 0 to 7 loop
SDA <= ADCAdressWR(i);
end loop;
result(0) <= SDA; -- ACK on LED
for i in 0 to 7 loop
SDA <= ADCSetup(i);
end loop;
result(1) <= SDA;
for i in 0 to 7 loop
SDA <= ADCAdressRD(i);
end loop;
result(2) <= SDA;
for i in 0 to 7 loop
temp(i) <= not SDA;
end loop;
for i in 1 to 8 loop
frame(i) <= temp(i-1);
end loop;
for i in 1 to 8 loop
frame(i) <= temp(i-1);
end loop;
txd <= frame(conv_integer(unsigned(shiftCounter)));
shiftCounter <= shiftCounter +1;
if shiftCounter = "1010" then
shiftCounter <= "0000";
end if;
end process
But it doesnt work. On terminal only thing i can see are 000000000...SCL Clock works in 4,8 kHz
Thanks in advance
i want to make a simple - very simple communication between my FPGA(SPRATAN XC2S300E) and ADC - MAX1037. Therefore i've made such a code:
...
signal frame : STD_LOGIC_VECTOR (9 downto 0);
signal shiftCounter : STD_LOGIC_VECTOR (3 downto 0) :="0000";
signal ADCAdressWR : std_logic_vector (7 downto 0) := "00010011";
signal ADCAdressRD : std_logic_vector (7 downto 0) := "10010011"; signal ADCConfiguration: std_logic_vector (7 downto 0) ;
signal ADCSetup : std_logic_vector (7 downto 0) := "00000001";
...
process(SCL)
begin
frame(0) <= '0'; --uart start bit
frame(9) <= '1';
if rising_edge(SCL) then
for i in 0 to 7 loop
SDA <= ADCAdressWR(i);
end loop;
result(0) <= SDA; -- ACK on LED
for i in 0 to 7 loop
SDA <= ADCSetup(i);
end loop;
result(1) <= SDA;
for i in 0 to 7 loop
SDA <= ADCAdressRD(i);
end loop;
result(2) <= SDA;
for i in 0 to 7 loop
temp(i) <= not SDA;
end loop;
for i in 1 to 8 loop
frame(i) <= temp(i-1);
end loop;
for i in 1 to 8 loop
frame(i) <= temp(i-1);
end loop;
txd <= frame(conv_integer(unsigned(shiftCounter)));
shiftCounter <= shiftCounter +1;
if shiftCounter = "1010" then
shiftCounter <= "0000";
end if;
end process
But it doesnt work. On terminal only thing i can see are 000000000...SCL Clock works in 4,8 kHz
Thanks in advance