- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi. I have DE0 board and it has 50MHz clock oscillator.
I want to make a digital clock, and I know How to change 50MHZ to 1Hz, But I don't know how to make the 50MHz oscillator start. When i push the button or swich, I want to make the 50MHz oscillator start to work. How can I do that? I have user manual , but it doesn't tell me how to do that.Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
to slow down your clock:
process(n_clr, clk) begin if(n_clr='0') then cont_reg <= ( others => '0' ); elsif(clk'event and clk='1') then cont_reg <= cont_prox; end if; end process; cont_prox <= cont_reg + 1 when ( cont_reg < 50000000 and cont_on='1' ) else ( others => '0' ) when ( cont_reg = 50000000 and cont_on='1' ) else cont_reg; tick_1s = '1' when ( cont_reg = 50000000 ) else '0'; to start your clock with a button make a state machine: process... if(n_clr='0') then est_reg = ini; elsif(clk.... est_reg <= est_prox; end.... process(... est_prox <= est_reg; cont_on <= '0'; case est_reg is when ini => if (button ='0' ) then est_prox <= contando; end if; when contando => cont_on <='1'; ...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try to use your clock to create a ramp... that's how you can slow down the clock.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks buddy! but.. what is the est_prox, est_reg, contando?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
est_reg, est_prox are current and next value of the state register of the state machine. You can declare this way:
architecture blablabla of... type estado is ( ini, contando,.. ); -- only 2 states. I don't know if your design need more. signal est_reg, est_prox : estado; begin ..... -- here starts the code, process, etc. As you see, contando is a state of the state machine.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page