Tested version of ADC state machine. Tested only to prove that 'something works'...
authorMartin Prudek <prudemar@fel.cvut.cz>
Sun, 5 Apr 2015 15:27:53 +0000 (17:27 +0200)
committerMartin Prudek <prudemar@fel.cvut.cz>
Sun, 5 Apr 2015 15:27:53 +0000 (17:27 +0200)
pmsm-control/rpi_mc_simple_dc.vhdl

index 11f97af..0ff098e 100644 (file)
@@ -238,6 +238,7 @@ begin
                        dat_reg(63 downto 61) <= hal_in(1 to 3); --halovy sondy
                        dat_reg(60 downto 36) <= (others => '1'); --let the rest fill with ones
                        dat_reg(35 downto 0) <= adc_channels(35 downto 0); --current mesurments
+                       adc_reset<='0'; --remove reset flag, and wait on its rising edge
                elsif (ce0_old = "01") then --rising edge of SS, we should read the data
                        adc_reset<=dat_reg(95);
                end if;
@@ -315,13 +316,16 @@ begin
                                if (data_ready='1') then
                                        case channel is
                                                when ch0=>
-                                                       adc_channels(35 downto 24)<=adc_data(11 downto 0);
+                                                       --adc_channels(35 downto 24)<=adc_data(11 downto 0);
+                                                       adc_channels(35 downto 24)<=(others=>'0');
                                                        channel:=ch1;
                                                when ch1=>
-                                                       adc_channels(23 downto 12)<=adc_data(11 downto 0);
+                                                       --adc_channels(23 downto 12)<=adc_data(11 downto 0);
+                                                       adc_channels(23 downto 12)<=(others=>'1');
                                                        channel:=ch2;
                                                when ch2=>
-                                                       adc_channels(11 downto 0)<=adc_data(11 downto 0);
+                                                       --adc_channels(11 downto 0)<=adc_data(11 downto 0);
+                                                       adc_channels(11 downto 0)<=(others=>'0');
                                                        channel:=ch0;
                                        end case;
                                end if;