process (clock,reset_in) is begin --Beginn der Anweisungen innerhalb Prozess Takt clockad_out <= clock; if rising_edge(clock) and reset_in='1' then case state_ADC is --Anfangszustand when 0 => Zustand <= "0000"; convst <= '0'; rd <= '0'; cs <= '0'; switch <= '0'; state_ADC <= 1; when 1 => Zustand <= "0001"; convst <= '1'; rd <= '1'; cs <= '1'; switch <= '0'; state_ADC <= 2; --Start AD Wandlung when 2 => Zustand <= "0010"; convst <= '0'; rd <= '1'; cs <= '1'; timeout <= 30; --Zählvariable fals bei Einschaltvorgang in when3 oder 4 gesprungen wird switch <= '0'; state_ADC <= 3; --Warten auf busyadc high when 3 => Zustand <= "0011"; timeout2 <= 30; if busyadc ='1' then convst <= '1'; rd <= '1'; cs <= '1'; switch <= '0'; state_ADC <= 4; else timeout <= timeout-1; if timeout =0 then state_ADC <= 1; end if; end if; --Warten auf busyadc low when 4 => Zustand <= "0100"; timeout <= 0; if busyadc ='0' then convst <= '1'; cs <= '0'; rd <= '0'; switch <= '0'; delay <= 5; state_ADC <= 5; else timeout2 <= timeout2-1; if timeout2 =0 then state_ADC <= 1; end if; end if; --Daten von AD Wandler lesen // Wert Feuchte, darf nur gelesen werden, wenn Taster Temperturanzeige --(show_temperature) nicht betätigt ist, da sonst der Wert der Temperatur ausgegeben wird when 5 => Zustand <= "0101"; timeout2 <= 0; convst <= '1'; cs <= '0'; rd <= '0'; switch <= '0'; delay <= delay-1; if delay =0 then --and show_temperature='0' Wert_Feuchte <= to_bitvector(Wert_Ad); end if; state_ADC <= 11; when 11 => Zustand <= "0110"; convst <= '1'; rd <= '1'; cs <= '1'; switch <= '1'; state_ADC <= 12; --Start AD Wandlung (nun für den Wert Druck) when 12 => Zustand <= "0111"; convst <= '0'; rd <= '1'; cs <= '1'; timeout3 <= 30; --Zählvariable fals bei Einschaltvorgang in when13 oder 14 gesprungen wird switch <= '1'; state_ADC <= 13; --Warten auf busyadc high when 13 => Zustand <= "1000"; timeout4 <= 30; if busyadc ='1' then convst <= '1'; rd <= '1'; cs <= '1'; switch <= '1'; state_ADC <= 14; else timeout3 <= timeout3-1; if timeout3 =0 then state_ADC <= 1; end if; end if; --Warten auf busyadc low when 14 => Zustand <= "1001"; timeout3 <= 0; if busyadc ='0' then convst <= '1'; cs <= '0'; rd <= '0'; switch <= '1'; delay2 <= 5; state_ADC <= 15; else timeout4 <= timeout4-1; if timeout4 =0 then state_ADC <= 1; end if; end if; --Daten von AD Wandler lesen when 15 => Zustand <= "1010"; timeout4 <= 0; convst <= '1'; cs <= '0'; rd <= '0'; switch <= '1'; delay2 <= delay2-1; if delay2 =0 then Wert_Druck <= to_bitvector(Wert_Ad); end if; systemzeit <= (systemzeit+1) mod 2**28; state_ADC <= 1; when others => Zustand <= "1111"; state_ADC <= 0; end case; --case state adc end if; --rising_edge(clock) and run='1' end process;