603,872 active members*
3,809 visitors online*
Register for free
Login
IndustryArena Forum > CNC Electronics > CNC Machine Related Electronics > Oscillator With Programmable Duty Cycle
Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2004
    Posts
    231

    Oscillator With Programmable Duty Cycle

    I am working on an application requiring that I digitally control the duty cycle of a fixed frequency oscillator. I did some research on the 'net and found a couple circuits to support this system. I spent a lot time understanding the circuit and decided to document how it worked here.

    Oscillator

    The CD4541BC programmable timer has a 16 stage binary counter, an integrated oscillator that uses an external capacitor and two resistors. The timer is also programmable by setting the digital inputs to divide the oscillator frequency by to 2^8, 2^10, 2^13, 2^16. The CD4541BC ocscillator frequency can be set by an external RC network that's by the following formula freq = 1 / (2.3 * Rtc * Ctc) where Rs = ~ 2Rtc and Rs >= 10,000 ohms. (Although I've had reasonable results with going down to 1k.)





    Obviously there is a lot of flexibility to control the frequency of the oscillator. For my application I just needed a fixed frequency which I set using switch S1. Users that want to control the frequency digitally you could control the frequency by putting TTL control lines on ports A and B.




    4-Bit Counter
    The next portion of the circuit involves a 74191 4-bit binary counter. The 74191 recieves a clock input and triggers each of the four outputs to produce a series of 4-bit words. The 74191 is called an up/down counter which means it is reversable and count up or down after each clock cycle. When the counter is counting up it produces these outputs on the rising edge of each clock cycle.




    Notice that the counter rolls over from 1111 to 0000 at the end of the series. Wiring for the 74191 is really simple. Pin 14 recieves the clock input from the timer and pins 1, 4, 5, 8, 9, 10, 15 are tied to ground. "N.C." stands for not connected. Pin 16 is tied to Vcc.



    Stay tuned for the next post...

    owen

  2. #2
    Join Date
    Jan 2004
    Posts
    231
    Magnitude Comparator 7485

    Suppose we had a chip that could read the signals at the outputs of the 74191 and tell when it was at a certain clock cycle. This is accomplished with a 7485 4-bit magnitude comparator. This magnitude comparator performs comparisons of two 4 bit words. The two 4-bit words are called A and B here. <B>Note:</B> The documentation for the 74191 is confusing because it calls the complete word "A", which has four bits (A0, A1, A2, A3) , however; in the 74191 each <i>bit</i> of the word was called A, B, C and D. The comparator has outputs which register when word A&lt;B, A=B, or when A&gt;B on pins 7, 6 and 5, respectively.

    Complete circuit

    What does this allow us to do? Well, if we wanted to count the pulses that are coming from the timer, we could set a word on the B input of the comparator, wait for the clock to cycle the counter up to that word, and watch the output of pins 6 and 7 of the comparator. The wiring for this circuit is as follows:



    The simple pulse generator allows you to program its duty cycle.

    The user can set the inputs to B0, B1, B2 and B3 as digital inputs to the 7485 magnitude comparator IC3. The timer, IC1, increments the 74193 4-bit counter, IC2. When the output of the counter is equal to or greater than your duty-cycle code, IC4 an OR gate, goes high until the counter, IC2, overflows. The input code to pins B0, B1, B2 and B4 determine duty cycle of the overall circuit. Suppose the desired duty cycle was 50%. The total number of clock cycles you can measure is 16, and half of those cycles is 8. The input code corresponding to clock cycle 8 is B0=1, B1=1, B2=1 and B3=0. At these settings the output's duty cycle will be 50%. For an input at clock cycle 4, the duty cycle is 25%.

    Here is a picture of the outputs of timer and PWM at 50% duty cycle:



    Note that the output frequency is CLK divided by 16.

    owen

  3. #3
    Join Date
    Jun 2003
    Posts
    3312
    What kind of resolution do you need, and at what frequency? If 256 parts (8 bits) is good, clock a d flip flop on equal (d held high) and reset it on counter overflow.
    Phil

  4. #4
    Join Date
    Jan 2004
    Posts
    231
    I could try that but any idea why it doesnt work? Why will the flip flop work any better?

    o

  5. #5
    Join Date
    Jun 2003
    Posts
    3312
    Prop delays through the gates some times glitch outputs. Comparators used to be known for that. In my day(74LS logic), you almost always did a sync design, rather than async.

    Phil

  6. #6
    Join Date
    Jan 2004
    Posts
    231
    Phil,

    I found this circuit on the net. is this what you had in mind by using a flip flop on equal?

    Owen
    Attached Thumbnails Attached Thumbnails programable_duty_cycle.gif  

  7. #7
    Join Date
    Jun 2003
    Posts
    3312
    No, not exactly, but along the correct lines. It sync's and eliminates the glitch's that the 85's were known so bad for.

    Phil

  8. #8
    Join Date
    Apr 2004
    Posts
    678
    If you don't mind a little programming, you can use this:
    http://www.avrfreaks.net/Devices/dev...ion=1&devid=44
    In addition you need one capacitor as you do for all digital circuits, and one potmeter to adjust your duty cycle in 1024 steps.
    You don't even need a circuit board, just solder it to your pot.
    It costs around $5.- in single quantity.
    On the same site you can find appnotes showing how to use the PWM and the ADC. You just need to "glue" the two together.

  9. #9
    Join Date
    Jul 2004
    Posts
    28
    If you want frequencies up to 32Khz is much easier to design a PWM with a PIC microcontroller.
    About your optics... if you want to cut metal, use feedback isolator. If not, you will destroy the optics in laser cavity from the reflected beam.

    I bought the same laser model (G-100) last February and I finish my 2m x 2m CNC laser last May.
    I can cut steel and s/s up to 2mm.

    Romos

  10. #10
    Join Date
    Jan 2004
    Posts
    231
    Romos,

    hey, thanks for the info on the laser. I'm going to move this over to another thread and ask you a question there.

    owen

Similar Threads

  1. Cycle Start button
    By kaleem1 in forum Mach Software (ArtSoft software)
    Replies: 7
    Last Post: 12-24-2005, 09:05 PM
  2. Programmable CNC I/O expansion
    By psevin in forum News Announcements
    Replies: 0
    Last Post: 03-04-2004, 06:49 PM
  3. Programmable CNC I/O expansion
    By psevin in forum News Announcements
    Replies: 0
    Last Post: 03-03-2004, 07:13 PM
  4. Post configuring (black art?)
    By John F in forum OneCNC
    Replies: 12
    Last Post: 07-18-2003, 07:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •