another newbee question

Discussion in 'VHDL' started by martstev@gmail.com, Aug 18, 2006.

  1. Guest

    I am having a mental block thinking about state machine for this
    design....

    I have a @ 14 Mhz clock, and 4 bit inputs and based on inputs, I want
    to genrate several timing signals

    so for example "0010" input : T1 PRI is 200us (PRF = 5kHz) (PulseWidth
    PW = 500ns) and T2 (PW = 1us) (PRF = 5khz) and T2 pulse starts 10ns
    after the leading edge of the T1

    another example: input = "0011" T1 PRI is 450us (PRF = 2.22kHz) (PW =
    500ns) and T2 (PW =17us) (PRF = 2.22Khz) and again T2 pulse starts
    10ns after the leading edge of the T1.

    So T1 PW is alwasy constant but PRF changes based on inputs and T2 PW
    is changing based on inputs but it alwats starts 10ns after the leading
    edge of the T1. PRF of T1 and T2 is same based on the input

    T1 and T2 is going to turn on/off LEDs.

    how I can design the state machines for this? I wasn't quite sure about
    how can I make a counter for this in the state machines!!! Please
    help...

    thanks,
    Mart Steve
     
    , Aug 18, 2006
    #1
    1. Advertising

  2. Can you explain a little more? Why do you need such timing if you're
    driving LEDs?

    ok, from what you said:

    1. if the input to your circuit is "0010" you create a 5KHz signal on T1,
    but it's not square, it has a 500ns high followed by 199.5us low???
    in this case T2 is also 500kHz, but it's width is 1us followed by 199us low?
    and it's delayed by 10ns to T1...

    ok, so the other inputs combinations change some frequency and width
    parameter.

    Where I would start is by making a circuit that implements one of the
    requirements... using constants to create the counters, i'm sure you don't
    need a stae machine for this.

    Then have a look and see what you'd need to change your constants to in
    order to implement one of the other sequences...

    These would be the values modified by a state machine....

    It might turn out to be way easier than you thought... you might do away
    with the state machine altogether.

    Ben



    <> wrote in message
    news:...
    >I am having a mental block thinking about state machine for this
    > design....
    >
    > I have a @ 14 Mhz clock, and 4 bit inputs and based on inputs, I want
    > to genrate several timing signals
    >
    > so for example "0010" input : T1 PRI is 200us (PRF = 5kHz) (PulseWidth
    > PW = 500ns) and T2 (PW = 1us) (PRF = 5khz) and T2 pulse starts 10ns
    > after the leading edge of the T1
    >
    > another example: input = "0011" T1 PRI is 450us (PRF = 2.22kHz) (PW =
    > 500ns) and T2 (PW =17us) (PRF = 2.22Khz) and again T2 pulse starts
    > 10ns after the leading edge of the T1.
    >
    > So T1 PW is alwasy constant but PRF changes based on inputs and T2 PW
    > is changing based on inputs but it alwats starts 10ns after the leading
    > edge of the T1. PRF of T1 and T2 is same based on the input
    >
    > T1 and T2 is going to turn on/off LEDs.
    >
    > how I can design the state machines for this? I wasn't quite sure about
    > how can I make a counter for this in the state machines!!! Please
    > help...
    >
    > thanks,
    > Mart Steve
    >
     
    Benjamin Todd, Aug 20, 2006
    #2
    1. Advertising

  3. KJ Guest

    <> wrote in message
    news:...
    >I am having a mental block thinking about state machine for this
    > design....
    >
    > I have a @ 14 Mhz clock, and 4 bit inputs and based on inputs, I want
    > to genrate several timing signals
    >
    > so for example "0010" input : T1 PRI is 200us (PRF = 5kHz) (PulseWidth
    > PW = 500ns) and T2 (PW = 1us) (PRF = 5khz) and T2 pulse starts 10ns
    > after the leading edge of the T1
    >
    > another example: input = "0011" T1 PRI is 450us (PRF = 2.22kHz) (PW =
    > 500ns) and T2 (PW =17us) (PRF = 2.22Khz) and again T2 pulse starts
    > 10ns after the leading edge of the T1.
    >
    > So T1 PW is alwasy constant but PRF changes based on inputs and T2 PW
    > is changing based on inputs but it alwats starts 10ns after the leading
    > edge of the T1. PRF of T1 and T2 is same based on the input
    >
    > T1 and T2 is going to turn on/off LEDs.
    >
    > how I can design the state machines for this? I wasn't quite sure about
    > how can I make a counter for this in the state machines!!! Please
    > help...
    >

    Not quite sure what all of that means but I'm guessing that you're trying to
    make two pulse width modulated output signals where for one of the outputs
    the overall period is variable (but with a constant pulse time = T1) and a
    second output where the pulse width is variable and I'm not sure about the
    overall period and there is the additional constraint of T2 having to switch
    10 ns after the leading edge of T1.

    Assuming that is somewhere in the ballpark then the state machine
    controlling 'T1' probably looks like something like the following code.
    Some caveats:
    - It's only meant to give a general idea, you've still got a few blanks to
    fill in but it should get you started.
    - It assumes that the clock period comes in on a generic to the entity and
    is of type 'time'. As a general rule one should try to avoid embedding too
    much application specific knowledge (like the 14 MHz) too deeply.
    - The 10 ns after T1 is problematic given a 14 MHz clock....10 ns implies a
    50/100 MHz clock

    Hope this helps though

    KJ

    process(Clock)
    variable T1_Period_Counter: natural range 0 to ???;
    variable T1_High_Time_Counter: natural range 0 to ???;
    begin
    if rising_edge(Clock) then
    if Reset = '1' then
    T1_Period_Counter <= 1;
    T1_High_Time_Counter <= 500 ns / Clock_Period;
    elsif (Load_Input = '1') or (T1_Period_Counter = 0) then
    case Input_Selector is
    when "0010" => T1_Period_Counter := 200 us /
    Clock_Period;
    when "0011" => T1_Period_Counter := 450 us /
    Clock_Period;
    when others => T1_Period_Counter := 1;
    end case;
    T1_High_Time_Counter := 500 ns / Clock_Period;
    T1_Output <= '1';
    else
    T1_Period_Counter := T1_Period_Counter - 1;
    if (T1_High_Time_Counter = 0) then
    T1_Output <= '0';
    else
    T1_High_Time_Counter := T1_High_Time_Counter - 1;
    end if;
    end if;
    end if;
    end process;
     
    KJ, Aug 20, 2006
    #3
  4. Peter Guest

    skrev:


    >
    > So T1 PW is alwasy constant but PRF changes based on inputs and T2 PW
    > is changing based on inputs but it alwats starts 10ns after the leading
    > edge of the T1. PRF of T1 and T2 is same based on the input
    >
    > T1 and T2 is going to turn on/off LEDs.
    >


    Hi,

    Why do you need the 10 ns delay? Does it have to be exactly 10 ns or is
    one period of your 14 MHz clock acceptable?

    /Peter
     
    Peter, Aug 21, 2006
    #4
    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. vbGansta
    Replies:
    0
    Views:
    303
    vbGansta
    Feb 16, 2004
  2. Valmir
    Replies:
    3
    Views:
    4,959
    xiko tripa
    Feb 18, 2004
  3. Who

    Newbee question

    Who, Apr 5, 2004, in forum: ASP .Net
    Replies:
    8
    Views:
    480
    Kevin Spencer
    Apr 5, 2004
  4. mbs

    Followup: Newbee Question

    mbs, Apr 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    309
    James Hancock
    Apr 6, 2004
  5. EMW
    Replies:
    3
    Views:
    331
    John Timney \(Microsoft MVP\)
    Apr 6, 2004
Loading...

Share This Page