Altera_Forum
Honored Contributor
10 years agoDEAD TIME TO CONTROL 2 SYNCHRONOUS MOSFET (BUCK CONVERTER) help!!!!!!!
HELLO.
I AM A STUDENT AND I AM TRYING TO IMPLEMENT AN STATE MACHINE TO CONTROL A BUCK CONVERTER. IN THIS PART OF CODE, I AM TRYING TO COMMUTE 2 MOSFET (HIGH SIDE AND LOW SIDE). EACH 20ms MOSFET1 (m1) IS IN "ON" AND MOSFET1 (m2) IN "OFF" AND THEN REVERSE. UP THIS POINT, THE CODE WORKS. BUT, I NEED TO PROGRAM A DEAD TIME TO PREVENT 2 MOSFETS ARE IN STATE "ON" DURING THE COMMUTATION TO AVOID A DEAD SHORT OF THE SOURCE. I put that this dead time has to be of 60ns. It is to assure that (for example): when m1 pass from state "1" to "0" then count to 60ns and then (we are assured that m1 doesn't work) to active m2 '1'. the delay part of the code is not here. i don't know how to do. it seems to be easy but....the condition "after" or "wait" is not permited because this code is for implementing and "after" and "wait" is only for simulation!!!
some help? thank you very much in advance!! ​
entity controllersource is generic(timeM: integer:= 1000000); --20 ms (switching time between Mosfets) generic(timeR: integer:= 3); --60 ns (delay to avoid being 2 MOSFETS in "on" state at the same time) Port( clk : in std_logic; rst : in std_logic; m1: out std_logic; -- Mosfet HIGH side m2: out std_logic); -- Mosfet LOW side end entity; architecture c1 of controllersource is signal counter: unsigned(23 downto 0); signal cont: unsigned(23 downto 0); signal y: std_logic; begin counter: process (clk, rst) begin if rst = '1' then counter<=(others => '0'); cont<=(others => '0'); elsif (clk'EVENT and clk = '1') then -- 1 clock period each 50Mhz counter<=counter+1; cont<=cont+1; if counter=timeM then -- 20ms counter<=(others => '0'); end if; if cont=tiempoR then -- 60ns cont<=(others => '0'); end if; end if; end process; commutation: process (clk, rst) begin if rst = '1' then m1<='1'; m2<='0'; y<='0'; elsif (clk'EVENT and clk = '1') then if counter=timeM then --every time that arrive to 20ms commute the state of mosfets if y='0' then y<='1'; m1<='0'; m2<='1'; else y<='0'; m2<='0'; m1<='1'; end if; end if; end if; end process; end c1;