CD40193 Binary U/D Counter help. What Preset inputs actually do?

Discussion in 'The Projects Forum' started by Mussawar, Aug 8, 2013.

  1. Mussawar

    Thread Starter Member

    Oct 17, 2011
    68
    3
    Hi,
    Sorry I could not upload the datasheet of 40193 because of file size limitation so a little snippet is attached. CD 4093 Binary U/D Counter has 4 preset inputs. Can somebody simply explain me what these pins actually do? (Pin 15, 1, 10 and 9. so called J1, J2, J3 and J4 along with “Preset Enable” Pin11) Actually I could not understand the purpose of these 4 preset inputs. How do these pins effect the counting? I have tried to search for it at google but could not get sufficient information in this regard.
     
    Last edited: Aug 8, 2013
  2. MrChips

    Moderator

    Oct 2, 2009
    12,452
    3,371
    Preset inputs allow you to start counting from any specified value.
    This is extremely useful if you wish to add or subtract a constant value.
    This is used, for example, when designing a frequency counter for a radio receiver where you need to add or subtract the intermediate frequency (IF) from the local oscillator frequency.

    It is also useful for designing a divide-by-n counter, for example if you want to design a digitally tuned frequency oscillator.
     
  3. JohnInTX

    Moderator

    Jun 26, 2012
    2,348
    1,029
    The logic values on J1-J4 are copied asynchronously (immediately) to Q1-Q4 when PE/ goes to logic 0. See Fig 3 of the datasheet and notice how the outputs are set to J1-J4 when PE/ pulses low.

    PE/ is not edge-triggered so the counter won't count until its returned to a logic 1. When it does, the count resumes from the preset value. In the example in Fig 3, the counter is 0 until PE/ is pulsed low with 0111 on J4-J1. The counter is immediately preset to '7' and counting is resumed from there.

    Presets are used to start counting at a particular value or to skip counts if the design requires.

    If you just want to count the full range of the counter, tie PE/ to 1 and J1-J4 high or low (for electrical reasons).

    Datasheet
     
    Last edited: Aug 8, 2013
  4. Mussawar

    Thread Starter Member

    Oct 17, 2011
    68
    3
    Thanks. Now a little more question, I have cascaded 2 ICs which will give me an 8 bit counter counting from 0~255 decimal. Now if I add another IC, it would be a 12 bit counter and will be counting from 0~4095 decimal; but I want to limit it for 999 decimal only. I mean when counter reaches at 999 decimal, it should stop counting and preferably reset to zero. Is there any way to do this? Can I use these preset inputs for this purpose? How?
     
  5. JohnInTX

    Moderator

    Jun 26, 2012
    2,348
    1,029
    Yes, adding another chip would get you a max count of 4095 in binary (since these are binary counters).

    To shorten the count, you would need to decode the bit pattern corresponding to 1000 (one past 999) and apply the decoded output to the reset input to clear the counter.

    THERE IS A PROBLEM HERE HOWEVER. Since the reset (or PE/ for that matter) is asynchronous (works independently of the clock) you have these issues:

    A glitch on the output when it goes from 999->1000->0. The momentary 1000 output can be a problem depending on what you hook it to.
    A worse problem can occur when 1000 is decoded and a low is applied to the resets of the counters. As soon as ONE of the decoded outputs changes due to reset, the reset pulse is no longer decoded, making the reset pulse very short. It may not be long enough to reset the other 2 chips reliably. Some additional circuitry to ensure that the reset pulse is stretched would be appropriate here.

    A better solution would be to use a 40161 which has a synchronous reset. In this case, 999 would be decoded directly (not one past 999) to the CLEAR/ input and on the next clock, the counter would smoothly reset to 000 with no glitching on the outputs. Its a much better way to do it and personally, the only way I would do it.

    Note that since you are resetting to 0 you don't need the preset inputs. Strap them to 1 or 0 and strap LOAD/ to 1. By counting to 999 I assume you are counting to 999 in binary as these are binary counters.

    Have fun.
     
    Last edited: Aug 8, 2013
    Mussawar likes this.
  6. crutschow

    Expert

    Mar 14, 2008
    13,056
    3,245
    You can also add a clocked flip-flop at the decoded output to give a synchronous reset for the CD40193.
     
  7. Mussawar

    Thread Starter Member

    Oct 17, 2011
    68
    3
    Thanks. I have studied 40161 data sheet and got it. I have to use an invertor for cascading but it is just fine. I'll try to workout it if 40161 is available in my local market. Any way thanks for such usefull replies. Regards
     
  8. MrChips

    Moderator

    Oct 2, 2009
    12,452
    3,371
    You do not have to use an inverter to cascade a 74161 or 40161.
    These are synchronous counters. You connect the CLOCK inputs together.
    The RIPPLE CARRY OUTPUT is connected to ENABLE T of the next stage.
    On the CD40161 data sheet the signals are called CO and TE.
     
    Last edited: Aug 8, 2013
Loading...