please please please take attention to my letter

Discussion in 'VHDL' started by mera, Mar 29, 2011.

  1. mera

    mera

    Joined:
    Mar 29, 2011
    Messages:
    5
    hi everyone
    my project is (control dc motor by using fpga) so i want from you to help me with the vhdl code as soon as you can i hope if you can this week
    because i am lost in vhdl :stupido3:
    thanks
    mera, Mar 29, 2011
    #1
    1. Advertising

  2. mera

    tebzoo

    Joined:
    Mar 29, 2011
    Messages:
    1
    hi mera, you know the way im so streesed i dnt even know how to use this forum, but what i know i need help..please
    tebzoo, Mar 29, 2011
    #2
    1. Advertising

  3. mera

    mera

    Joined:
    Mar 29, 2011
    Messages:
    5
    hi every one please why no one help me
    hahaha tebzoo we are lost in vhdl
    mera, Mar 31, 2011
    #3
  4. mera

    joris

    Joined:
    Jan 29, 2009
    Messages:
    152
    I think you may get help if you make your question more specific
    joris, Apr 1, 2011
    #4
  5. mera

    mera

    Joined:
    Mar 29, 2011
    Messages:
    5
    ok joris i mean i want to write a progrme in vhdl to make a counter to make it as duration for pwm but i want to make it parallel counter then i need to make a divider to make the frequency less than 30 kHz with a dc input( 5 volt )
    i try to write a program but there is an error and i could not solve it\

    this is the program that i try to write

    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.STD_LOGIC_ARITH.ALL;
    use IEEE.STD_LOGIC_UNSIGNED.ALL;
    ENTITY pwm1 IS
    PORT(
    clk : IN std_logic;
    connect : buffer std_logic;
    pwm_in : in std_logic_vector(4 downto 0);
    pwm_out : out std_logic);
    END pwm1;
    architecture behavorial of pwm1 is
    signal clk1: std_logic;
    signal count: std_logic_vector (4 downto 0) := "00000";
    BEGIN
    divisor: process (clk)
    variable resolution : integer:=0;
    constant resolution_limit : integer := 32;
    variable divider : integer:=0;
    constant divider_limit : integer :=1000;
    begin
    if (clk'EVENT AND clk='1') then
    if divider = divider_limit then
    divider := 0;
    else
    divider := divider + 1;
    end if;
    clk1 <= clk;

    if resolution = resolution_limit then
    resolution := 0;
    connect <= '1';
    else
    resolution := resolution + 1;
    connect <= '0';
    end if;
    end if;
    end process divisor;

    pwm: process (clk1)
    begin
    if connect ='1' then count <= "00000";
    elsif clk1'event and clk1 ='1' then
    count <= count + '1';
    if count < pwm_in then
    pwm_out <= '1';
    else
    pwm_out <= '0';
    end if;
    end if;
    end process pwm;

    END behavorial;


    i dont think so you can understand me because i could not explane what i need
    but i hope you can help me as soon as you can because i need it sunday
    mera, Apr 1, 2011
    #5
  6. mera

    jeppe

    Joined:
    Mar 10, 2008
    Messages:
    348
    Location:
    Denmark
    Hi Mera

    Try to find inspiration here: jjmk.dk/MMMI/Exercises/05_Counters_Shreg/No7_PWM_vs_SigmaDelta/index.htm

    Copy to the address line.
    jeppe, Apr 2, 2011
    #6
  7. mera

    jeppe

    Joined:
    Mar 10, 2008
    Messages:
    348
    Location:
    Denmark
    Hi again

    I'm not sure about the purpose of Resolution and Connect - but one should be better

    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.STD_LOGIC_ARITH.ALL;
    use IEEE.STD_LOGIC_UNSIGNED.ALL;
    ENTITY pwm1 IS
          PORT(
                clk : IN std_logic;
                connect : buffer std_logic;
                pwm_in : in std_logic_vector(4 downto 0);
                pwm_out : out std_logic);
          END pwm1;
          
    architecture behavorial of pwm1 is
       signal clk1: std_logic;
       signal count: std_logic_vector (4 downto 0) := "00000";
    BEGIN
    
       divisor: process (clk)
          variable resolution : integer:=0;
          constant resolution_limit : integer := 32;
          variable divider : integer:=0;
          constant divider_limit : integer :=1000;
       begin
          if (clk'EVENT AND clk='1') then
             if divider = divider_limit then
                divider := 0;
                Clk1 <= '1';
             else
                divider := divider + 1;
                Clk1 <= '0';
             end if;
    
             if resolution = resolution_limit then
                resolution := 0;
                connect <= '1';
             else
                resolution := resolution + 1;
                connect <= '0';
             end if;
          end if;
       end process divisor;
    
       pwm: process (Clk, connect)
       begin
          if connect ='1' then
             count <= "00000";
          elsif clk'event and clk ='1' then
             if Clk1='1' then
                count <= count + '1';
                if count < pwm_in then
                   pwm_out <= '1';
                else
                   pwm_out <= '0';
                end if;
             end if;
          end if;
       end process pwm;
    
    END behavorial
    ;
    jeppe, Apr 2, 2011
    #7
  8. mera

    mera

    Joined:
    Mar 29, 2011
    Messages:
    5
    hi thank you very much
    The resolution is very important to be sure that i can take a lot of number of speed and we can make that by increase the digit of the “resolution_limit”.
    i mean change the velocity of the motor by change the magnitude of resolution_limit
    mera, Apr 2, 2011
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vertigo

    big letter -> small letter

    vertigo, Jul 6, 2004, in forum: Python
    Replies:
    4
    Views:
    753
    Reinhold Birkenfeld
    Jul 6, 2004
  2. Tony Meyer

    RE: big letter -> small letter

    Tony Meyer, Jul 6, 2004, in forum: Python
    Replies:
    0
    Views:
    504
    Tony Meyer
    Jul 6, 2004
  3. Andrew McNamara

    Re: big letter -> small letter

    Andrew McNamara, Jul 6, 2004, in forum: Python
    Replies:
    2
    Views:
    749
    Scott David Daniels
    Jul 6, 2004
  4. N1hyipcom
    Replies:
    0
    Views:
    269
    N1hyipcom
    Nov 3, 2006
  5. saifullah
    Replies:
    0
    Views:
    322
    saifullah
    Aug 19, 2008
Loading...

Share This Page