Variable Speed Clock

Recommended Posts

Hello I would like to make a variable speed clock. Basic design is two push buttons and one output.

One pushbutton increase clock

Other pushbutton decreases clock


I am not worried about exact hz numbers just increase decrease at the moment.


I was wondering if anybody had a simple way of doing this.


Share this post

Link to post
Share on other sites

Make an accumulator, have the push buttons increment and decrement the value added to the accumulator each cycle, take the top bit of the accumulator as the clock.

This is a very simple implementation of a numerically controlled oscillator.

Share this post

Link to post
Share on other sites

     It really depends on how you want to do it. In Zap IDE or Xilinx IDE (C, verilog or VHDL) and how you want it to work with hardware (i.e. led, 7 segment or serial monitor). I worked on a bit file in Xilinx that will blink an led. If you have a papilio  pro and a logic start you can use it !clockdivider_top.bit.

     Swich 0 must be on and pressing joy select will go from 50 Hertz to about 0.4 Hertz in 8 steps. I used 2 clock dividers, 2 delays, a counter and a 8 to 1 mux.

     Zap IDE would probably be easier. Arduino Cookbook is a great place to start. Go to

http://examples.oreilly.com/0636920022244/ and download the files. Look at sections 3.2 +&- values, 5.1

switches, and 12.4 on setting up an actual clock (for the serial monitor). Arduino.cc is OK but lacks alot of details. I am not sure if the example codes can just be copy pasted into zap, but it is a start. If you get stuck just post again (and give lots of details). :) Good Luck

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now