]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control.git/blobdiff - pmsm-control/rpi_pmsm_control.vhdl
Added reading of irc_index position.
[fpga/rpi-motor-control.git] / pmsm-control / rpi_pmsm_control.vhdl
index 52e362f59b67c291bd1c398cb8aed21f27fea020..45ea914ac46af22bba59f04304c3b76918f55d25 100644 (file)
@@ -165,6 +165,7 @@ architecture behavioral of rpi_mc_simple_dc is
        signal gpio_clk: std_logic;
        signal dat_reg : STD_LOGIC_VECTOR (127 downto 0); --shift register for spi
        signal position: std_logic_vector(31 downto 0); --pozice z qcounteru
+       signal index_position: std_logic_vector(11 downto 0);           --pozice irc_i
        signal ce0_old: std_logic_vector(1 downto 0);
        
        --pwm signals
@@ -300,6 +301,11 @@ begin
        pwm(3) <= pwm_sig(3) and dip_sw(3);
        
                
+       process
+       begin
+               wait until (irc_i'event and irc_i='1');
+               index_position(11 downto 0)<=position(11 downto 0);
+       end process;
        
        process
        begin
@@ -345,9 +351,7 @@ begin
                        income_data_valid<='0';
                        dat_reg(127 downto 96) <= position(31 downto 0); --pozice
                        dat_reg(95 downto 93) <= hal_in(1 to 3); --halovy sondy
-                       dat_reg(92 downto 90) <= pwm_en_p(1 to 3); --enable positive
-                       dat_reg(89 downto 87) <= pwm_en_n(1 to 3); --shutdown
-                       dat_reg(86 downto 81) <= (others=>'0');--pwm_match(1)(10 downto 5); --6 MSb of PWM1
+                       dat_reg(92 downto 81) <= index_position(11 downto 0);   --position of irc_i
                        dat_reg(80 downto 72) <=adc_m_count(8 downto 0);        --count of measurments
                        --data order schould be: ch2 downto ch0 downto ch1
                        dat_reg(71 downto 0) <= adc_channels(71 downto 0);      --current mesurments