Thread: Recreating Clock Code

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    1

    Recreating Clock Code

    Hi,

    I am a first time programmer trying to compile some basic code in replacement for an electronic component.

    I am working a circuit with various counters, multiplexers etc which will be fed into a Pico ADC 11.

    Initially I was using a '555 timer' to control the rate of the entire circuit - as it produces a digital clock wave with adjustable period.

    I am looking to recreate this output clock signal. The clock signal must be adjustable to run at various speeds, i.e. an adjustable period. The output signal is created from the ADC 11 which I can program using C or any other language.

    I have downloaded the "Code::Blocks and the MINGW Compiler on Windows" - as recommended for beginners - and have been trying to figure everything out but am getting no where.

    I was hopeful someone could point me in the correct direction.

    Thank you
    AR

  2. #2
    Math wizard
    Join Date
    Dec 2006
    Location
    USA
    Posts
    582
    Just use a normal timer and multiply/divide by a number to get your intended result. For example:

    CurrentTime = RealTime * Scale;

    RealTime is what you'd base it off of and Scale is the offset.
    High elevation is the best elevation. The higher, the better the view!
    My computer: XP Pro SP3, 3.4 GHz i7-2600K CPU (OC'd to 4 GHz), 4 GB DDR3 RAM, X-Fi Platinum sound, GeForce 460, 1920x1440 resolution, 1250 GB HDD space, Visual C++ 2008 Express

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    The 555 is a wonderful chip. I'd think twice before using software to replace it's function. Monitoring/handling the time is a huge burden for a cpu.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Outside influences on clock cycles? (clock_t)
    By rsgysel in forum C Programming
    Replies: 4
    Last Post: 01-08-2009, 06:15 PM
  2. Proposal: Code colouring
    By Perspective in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 07:23 AM
  3. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  4. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM