Counting digital pulses and resetting - diyAudio
Go Back   Home > Forums > Source & Line > Digital Line Level

Digital Line Level DACs, Digital Crossovers, Equalizers, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 2nd May 2012, 06:19 AM   #1
akis is offline akis  United Kingdom
diyAudio Member
 
Join Date: Jul 2008
Default Counting digital pulses and resetting

I have a 555 generating pulses feeding a 4029 or a 4017 which counts them. When the 4029/4017 reaches, say, 5 counts, I detect it with a couple of AND gates and then reset the 4029/4017 so it starts counting again from 0.

This works fine when the output of the divider/counter is used to drive say a 7-seg display or an LED.

However this technique of resetting still allows the count to reach number '5' even for a few milliseconds and this is undesirable. What is the proper way of counting to X and resetting at X+1 but without allowing X+1 to appear at the output ?
  Reply With Quote
Old 2nd May 2012, 06:29 AM   #2
diyAudio Member
 
jan.didden's Avatar
 
Join Date: May 2002
Location: Great City of Turnhout, Belgium
Blog Entries: 7
Are you really seeing a few mS of '5'? I can imagine a spike of less than a microsecond, but if it's milliseconds there's something wrong.
Do you have a schematic?

jan
__________________
I won't make the tactical error to try to dislodge with rational arguments a conviction that is beyond reason - Daniel Dennett
Check out Linear Audio Vol 7!
  Reply With Quote
Old 2nd May 2012, 07:06 AM   #3
akis is offline akis  United Kingdom
diyAudio Member
 
Join Date: Jul 2008
Maybe not 100s of milliseconds but there is a spike at the output. As you can see the outputs will also need to drive relay switches, and I am scared that some relays receiving spikes and maybe even accidentally switch on.
Attached Images
File Type: jpg 555 and counters.JPG (361.3 KB, 43 views)
  Reply With Quote
Old 2nd May 2012, 07:07 AM   #4
godfrey is offline godfrey  South Africa
diyAudio Member
 
Join Date: Nov 2009
Location: Cape Town
Maybe skip the and gates? Here's something similar for inspiration: PROPORTIONAL RADIO CONTROL by SM0VPO

edit: Oops, cross-post.
Attached Images
File Type: gif rc-enc.gif (2.6 KB, 40 views)
  Reply With Quote
Old 2nd May 2012, 08:02 AM   #5
diyAudio Member
 
jan.didden's Avatar
 
Join Date: May 2002
Location: Great City of Turnhout, Belgium
Blog Entries: 7
Quote:
Originally Posted by akis View Post
Maybe not 100s of milliseconds but there is a spike at the output. As you can see the outputs will also need to drive relay switches, and I am scared that some relays receiving spikes and maybe even accidentally switch on.
Probably the problem is that you correctly decode the '5' but to reset the counter, you need another clock pulse and until that one comes along, the '5' is tehre.
So you should use the gate detection of '5' to reset and clock the counter at the same time. You can combine clocks with a couple of diodes.
Or maybe you should invest some time in using a microcontroller. Cheaper and simpler, but needs a learning curve.

jan
__________________
I won't make the tactical error to try to dislodge with rational arguments a conviction that is beyond reason - Daniel Dennett
Check out Linear Audio Vol 7!
  Reply With Quote
Old 2nd May 2012, 08:14 AM   #6
akis is offline akis  United Kingdom
diyAudio Member
 
Join Date: Jul 2008
Quote:
Originally Posted by janneman View Post
Probably the problem is that you correctly decode the '5' but to reset the counter, you need another clock pulse and until that one comes along, the '5' is tehre.
So you should use the gate detection of '5' to reset and clock the counter at the same time. You can combine clocks with a couple of diodes.
Or maybe you should invest some time in using a microcontroller. Cheaper and simpler, but needs a learning curve.

jan
The chip resets immediately on the '5' - here is the simulated oscilloscope output from pin '3' at the top and the clock pulse at the bottom. The intention is to count: '1', '2', '1', '2', '1' .... so when the '3' comes in the count goes back to '1' - but there is a spike that appears (necessarily) on '3'.

Maybe this spike is nothing to worry about, I am just looking for a cleaner way.

I have no experience with microcontrollers, but I have read they are programmable in assembly, and I do code in assembly (Z80, 68000 and mostly 80x86) - however it probably is a huge learning curve for me right now.
  Reply With Quote
Old 2nd May 2012, 08:16 AM   #7
diyAudio Member
 
jan.didden's Avatar
 
Join Date: May 2002
Location: Great City of Turnhout, Belgium
Blog Entries: 7
I did my share of assembly, but that's sooo 20th century ;-)

Now adays I use Flowcode to just 'draw' the flowchart, sim it to check and let the computer worry how to convert it to a hex file and load it into the controller.

jan
__________________
I won't make the tactical error to try to dislodge with rational arguments a conviction that is beyond reason - Daniel Dennett
Check out Linear Audio Vol 7!
  Reply With Quote
Old 2nd May 2012, 08:18 AM   #8
diyAudio Member
 
Join Date: Nov 2009
Location: Los Angeles
Quote:
Originally Posted by akis View Post
I have a 555 generating pulses feeding a 4029 or a 4017 which counts them. When the 4029/4017 reaches, say, 5 counts, I detect it with a couple of AND gates and then reset the 4029/4017 so it starts counting again from 0.

This works fine when the output of the divider/counter is used to drive say a 7-seg display or an LED.

However this technique of resetting still allows the count to reach number '5' even for a few milliseconds and this is undesirable. What is the proper way of counting to X and resetting at X+1 but without allowing X+1 to appear at the output ?
So latch the display on the other edge of the clock pulse so the counter will reset while you're not looking. Cheesy but effective and no worse than 555 timers.

Or, take a totally different approach and use a microcontroller and do the 7 segment decoding in software where you can easily implement text in addition to digits. Of course I'm advocating mission creep but fewer packages. Or use a multicharacter display instead of discrete 7 segment units.

G
  Reply With Quote
Old 2nd May 2012, 10:24 AM   #9
DF96 is offline DF96  England
diyAudio Member
 
Join Date: May 2007
Use a low pass filter to drive a Schmitt trigger? That will smooth away the spike. Remember, all digital circuits are merely overdriven analogue circuits so you can use analogue tricks - the circuit itself is using all sorts of analogue tricks you don't want (stray capacitance, ground bounce etc.) so why not add one you do want?
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
irs2092 resetting with low frequencies. nigelwright7557 Class D 84 20th February 2011 09:06 PM
Digital counter for counting to e.g 4 or 8 lykkedk Digital Source 0 17th May 2004 06:30 PM
Nineteen Hundred Ninety Nine Posts And Counting ;-)... mrfeedback Everything Else 12 21st May 2003 05:59 PM


New To Site? Need Help?

All times are GMT. The time now is 04:44 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2