]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control.git/blobdiff - pmsm-control/rpi_mc_simple_dc.vhdl
Tested version of ADC state machine. Tested only to prove that 'something works'...
[fpga/rpi-motor-control.git] / pmsm-control / rpi_mc_simple_dc.vhdl
index 11f97afece3a11e430a13e36a3067b572180e59a..0ff098ed9f72736f5c0ea4a190f9b4d8bc523731 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;