Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

help please......frequency divider

how to convert 25Mhz to 1hz,2hz till 10 hz....?

and use level select to select the frequency..this is the detail:

level 1-10 will select to frequency 1Hz to 10Hz..

i just can do till 1 Hz only but still dont know whether its correct or not....:(

tq....

12 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    if im using std_logic_vector type...how?

    generic(n: natural :=25);

    port( divCLK: in std_logic;

    level:in std_logic_vector (3 downto 0);

    Q: out std_logic);

    end countersystem;

    ----------------------------------------------------

    architecture behv of countersystem is

    signal clkdiv: std_logic_vector(n-1 downto 0);

    begin

    process(divCLK)

    begin

    if rising_edge(divCLK) then

    clkdiv <= clkdiv + 1;

    end if;

    Q<=clkdiv(24);

    from this i can get 1Hz, but how to get 2Hz,3Hz and so on from these coding...

    is it

    Q<=clkdiv(23),Q<=clkdiv(22)...and so on?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    how to convert 25Mhz to 1hz,2hz till 10 hz....?

    and use level select to select the frequency..this is the detail:

    level 1-10 will select to frequency 1Hz to 10Hz..

    --- Quote End ---

    A counter that counts down from either 12,500,000 (1 Hz); 6,250,000 (2 Hz)...1,250,000 (10 Hz) would be a place to start. When the counter counts down and rolls over from 0 back to the max listed above, then toggle the output clock.

    --- Quote Start ---

    i just can do till 1 Hz only but still dont know whether its correct or not....:(

    tq....

    --- Quote End ---

    Use a simulator and measure the output clock period.

    Kevin Jennings