LED blinking using counter

Discussion in 'General Electronics Chat' started by vead, Sep 19, 2016.

  1. vead

    Thread Starter Active Member

    Nov 24, 2011
    621
    8
    Hello
    Is it possible to create specific delay using counter? I did simple experiment. I have connected led at output pin of counter. I saw led is turn on and off.
    Let's suppose, is it possible to turn on Led on and off LED for 1 second?

    LED blinking with counter.png
     
  2. cmartinez

    AAC Fanatic!

    Jan 17, 2007
    3,573
    2,539
    Yes, it's certainly possible. But why not use a simple 555 (or a 556) instead of a counter to get what you want?
    On the other hand, if you're using a crystal oscillator to drive the counter, then said device would be more precise than the former. But remember, you're only flashing a LED, you don't really need that much precision.
     
  3. vead

    Thread Starter Active Member

    Nov 24, 2011
    621
    8
    Yes agree, just learning purpose. I understand the working of 74ls163. It increments or load the value. I wanted to see that how it create specific delay for LED.
     
  4. cmartinez

    AAC Fanatic!

    Jan 17, 2007
    3,573
    2,539
    It's really not that hard, it's a function of the oscillator frequency, and the counter itself. It's rather simple math. Do you need help with that?
     
  5. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,052
    3,815
    @vead
    The 74LS163 COUNTS pulses and outputs a binary number to represent how many pulses it counted (until it rolls over to zero when all of its bits are full). Q3 Q2 Q1 and Q0

    The 74LS163 does not generate pulses from DC voltage.

    The 74LS163 can divide the pulses to a lower frequency by looking at the Q0 will pulse the same rate as the clock input (pulses put into the 74-163); Q1 will flash at half the frequency of Q0 and so on.

    Do you understand the difference between a clock (creates a stream of pulses from DC supply) and a counter (counts the pulses)?
     
    vead likes this.
  6. vead

    Thread Starter Active Member

    Nov 24, 2011
    621
    8
    As I know time=1/frequency. Suppose I need two second delay than I have to use 1/2 hz crystal clock
    My question is can we set specific delay without changing clock frequency.
     
  7. ci139

    Member

    Jul 11, 2016
    341
    38
    if you use your existing configuration then you can set up the lowermost 3 bits 1+(8-(8-1))to(8-(8-8)) -- f.x=f.clk/(2 to 9) for frequency divider to generate a quanted delay t=1/f.x
    as - as the counter counts only up - each time the lowermost bits change from 7 to 0 you set the NLOAD pin and load your divisor at next or extra (double frequency) clock at last case your divisor changes from (1 to 8)
    i f your input \_/¯\ clock cycle length is 1ms (1/1ms=1kHz)
    Hi bits Lo // action // time used for /// !!! Modified !!!
    H000→H101 // load encoded divisor 5 OR 4-th output bit , CLEAR NLOAD (, inc. counter when using double frequency init)// 1ms
    H101→H110 // count up // 1ms
    H110→H111 // count up // 1ms
    H111→h000 // count up , strobe LED (H/h) , SET NLOAD // 1ms - total 4ms cycle 1 + (8-(8-(4ms-1))) = 9-9+4ms , enc.div = 9-4ms=5
    as for led the delay.x is half-cycle so LED frequency will be 1/[2·(2 to 9)] or 1/[2·(1 to 8)] for fast load/init (@ double-clock)
     
    Last edited: Sep 19, 2016
    cmartinez likes this.
  8. hp1729

    Well-Known Member

    Nov 23, 2015
    1,952
    219
    "Clock frequency" divided by "counter" = flash rate.
    Or
    "Desired flash rate" times "counter" = clock frequency.
     
    cmartinez likes this.
  9. cmartinez

    AAC Fanatic!

    Jan 17, 2007
    3,573
    2,539
    Both ci139 and hp1729 have given you pretty good answers. My only observation is that your oscillator frequency will determine your timer's resolution. That is, the resulting time lapse will always be a multiple of your base frequency. In example, if you use a 10Hz oscillator, then the smallest unit of time that you can use to determine any time lapse will be 0.1 seconds. You won't be able to generate a pulse lasting, for instance, 0.05 seconds, without adding more complex electronics.
     
    vead likes this.
  10. hp1729

    Well-Known Member

    Nov 23, 2015
    1,952
    219
    Design 862 flashing LED.PNG

    Something like the above. LM555 oscillates at about 16 Hz. The counter divides by 16. The LED gives a bright blink about every second.
    The configuration of the LM555 gives a 50% duty cycle.
    The 74LS163 has ENT and ENP enabled, Parallel loading is disabled.
    The output should give one clock pulse width about every second.
    I didn't build it or simulate it yet, but it should work.
    Just for the theory, the resistor on the LED could be omitted. It gets a very short pulse so drive the heck out of it.
     
    Last edited: Sep 19, 2016
  11. ci139

    Member

    Jul 11, 2016
    341
    38
    i made a test of what i proposed
    it seems that stacking too many events into tight time frame
    gets a kick back from device capabilities
    and the share amount of quality information on datasheets
    1. setting up a variable cycle DEMO introduced new issues
      -- that wouldn't had to be implemented otherwise
    2. the major problem rises from ::
      A. attempt to use Q3 for LED driving (other than "3." below) -- conceptually
      - - - i had to introduce an addittional storage buffer for Q3 to load it
      - - - because using the "Terminal count" for updating it disabled using "variable mod-s" for DEMO
      B. loading the counter bit-lines at "Terminal count"
      C. using the "mod 2" cycle with this configuration
      without practical requirements stated for such multi mode device
      it's difficult to say what exactly should happen at "mod 2" mode
      in the DEMO it's assumed for "Count 0"(e.g."mod 2") that the Q3 is not changed
      which is not a must and can be disabled by changing CLRX to CLR for lower leftmost 4003​
    3. attempting to draw power from digital lines for other uses (LED)
      . . . as for forward signal reference simultaneously (killing sharp signal edges confusing timing . . .)
    the control required to implement a seemingly easy thing turned out to be quite extensive

    i needed to test the decade v. model of SN74x163 anyway so i give that also a try

    SN74LS163V TEST - 2aa_plt.png
    SN74LS163V TEST - 2aa_tps.gif
     
  12. hp1729

    Well-Known Member

    Nov 23, 2015
    1,952
    219
    Nothing in your zip file was viewable to me.

    Maybe using the QD output will give you the result you want.
     
Loading...