Posted: Sun Jun 28, 2009 2:29 am Post subject:
How to "wrap" a pair of 4029s? Subject description: Any CMOS gurus know how to tackle this?
The pair of 4029s (pictured) sucessfully count up and down across 8bits (256steps) using the carry out of the first connected to the carry in of the second.
What I want next is a way of getting the whole counter to change direction when the count equals 00000000 or 11111111, thereby "wrapping" the edges around.
I've done a bit of experimenting with a 4027 J-K and a 4013 D type flip-flops, trying to use the effects of the unused "carry" pins, (5 on the upper and 7 on the lower) but can't get it to work yet.
According to the data sheet, carry in will go high for as long as all outputs are low, and carry out will go low for as long as all outputs are high.
Re-Animator-Main-Clock-28-6.gif
Description:
Filesize:
13.32 KB
Viewed:
822 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.
_________________ What makes a space ours, is what we put there, and what we do there.
Joined: Jan 29, 2007 Posts: 300 Location: Australia
Audio files: 1
Posted: Sun Jun 28, 2009 9:13 pm Post subject:
I reckon you're on the money with the flip-flop idea.
I don't think you will be able to use the carry in/out signals to identify when the direction change should occur though as I think the carry out on the second counter will fire when it reaches 1111/0000 (depending on the direction) regardless of the state of the first counter. A more reliable method might be to decode the outputs to find 00000000 and 11111111 and drive a flip flop connected to the U/D lines.
Attached is the circuit I knocked up to simulate this in Cedar logic. This seems to do what you want it to.
CountUpThenDownAndBackAgain.PNG
Description:
Filesize:
15.49 KB
Viewed:
828 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.
Joined: Jan 29, 2007 Posts: 300 Location: Australia
Audio files: 1
Posted: Sun Jun 28, 2009 9:22 pm Post subject:
Actually you can simply that previous circuit a whole bunch by ANDing the carry out of both counters and sending the result to the clock of the flip flop.
Cheers,
Adam-V
CountUpThenDownSimpler.PNG
Description:
Filesize:
9.91 KB
Viewed:
979 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.
Does this last schem really work? It seems way too simple to be true, but it's exactly the kind of simple solution I thought might be possible. Thanks heaps Adam, I'll give it a go and let you know. _________________ What makes a space ours, is what we put there, and what we do there.
Joined: Jan 29, 2007 Posts: 300 Location: Australia
Audio files: 1
Posted: Mon Jun 29, 2009 3:20 pm Post subject:
I ran it through cedar logic and it works there. Simulators and reality do not necessarily coincide but I reckon it should do what you're after. Please do let us know if it works.
I'm gonna try it this morning.
The main thing that came up while I've been mulling it over was whether, because it's only using the carry out, it might count down to 00000000 then hit 11111111 before changing direction. This would cause a momentary spike in the R/2R output. (It's the main counter on my Re-Animator)
If that's the case, it's possible I could use the same reasoning to trigger the FF "from the other side" also, with a pair of inverters and another AND hanging off the carry ins.
I don't spose you could try that in cedar logic could you?
Thanks heaps either way,
Andrew _________________ What makes a space ours, is what we put there, and what we do there.
When I AND both carry outs, it flatlines, (ie the counters sit on the same value, OR they are jumping back and forth between two adjacent values)
BUT,.... when I just send the second carry out to the flip-flop, it works fine!
I had to send my master sync signal to the set input of the flip-flop so it started in the same direction for each wave, but that's cool. It even adds the option of starting with an up or down count, (Set/Reset)
I still haven't checked the possible spike effect, which in this case might still be apparent, as it would still tip over from all 0s to all 1s in order to change direction and come back to all 0s. That fraction of a second at all 1s may be audible, but I can't see a spike on the scope. _________________ What makes a space ours, is what we put there, and what we do there.
Here's a quick mp3. I still haven't sorted out taking a shot of the scope, so open it with Soundforge etc, just to have a look at the wave.
It's very low frequency, as I had to wind out the sync from my VCO so I could get a bottom and top turn around included.
Which you can see very clearly. The wave "bounces" off the upper and lower edges.
The vertical flat point is where the sync pulse resets the wave to start again.
Re-Animator 30-6-09.mp3
Description:
Filesize:
80.61 KB
Viewed:
2177 Time(s)
_________________ What makes a space ours, is what we put there, and what we do there.
Joined: Jan 29, 2007 Posts: 300 Location: Australia
Audio files: 1
Posted: Mon Jun 29, 2009 7:25 pm Post subject:
Interesting. There maybe a difference in the way Cedar handles U/D counters versus the real world.
What should happen is, when counting up and 11111111 is reached, is that the carry out of both counters should pulse (counter 1 briefly before counter 2). Similarly when counting down, the same should happen when 00000000 is reached. This should clock the latch and change the direction logic accordingly.
Maybe you have an issue with edges here, some flip flops and counters are positive edge triggered, others are negative edge. I just tried this in Cedar by inverting the ANDed carry out signal before sending it to the flip flop clock input and you get some weird results, flipping between 00000000 and 11111111.
Running with just the carry out of the second counter causes it to count between 00001111 and 11101111 as the second counter outputs a carry pulse when it reaches 0000 or 1111 depending on the direction.
You can download Cedar logic from here - its free.
Joined: Jan 29, 2007 Posts: 300 Location: Australia
Audio files: 1
Posted: Mon Jun 29, 2009 7:36 pm Post subject:
Just looking at the datasheets, both the 4029 and 4013 are positive edge triggered so that can't be the issue.
You could try ripple clocking them rather than parallel clocking.
Take the carry out of counter 1 and apply it to the clock in of counter 2 instead of your clock signal. Then use the carry out of counter 2 to toggle the flip flop which controls the direction.
I can't remember why I didn't want to ripple count them. There's something I'm missing here about the nature of the carry in/out.
Anyway, it seems to work fine with just the carry out from the second one. I'm going to investigate the functionality of the carry pins and see if I can work out why.
Looking at the scope, it is definitely reversing at each end, and there's no spike at the turn around point. _________________ What makes a space ours, is what we put there, and what we do there.
the second counter outputs a carry pulse when it reaches 0000 or 1111 depending on the direction
I just re-read the description in the datasheet, and the above statement is true "provided the carry input is at logical 0 state."
Does that change what we are expecting? I'm getting myself very confused about what is happening across both counters in the up and down modes. _________________ What makes a space ours, is what we put there, and what we do there.
I don't know if I'd say I've got it sussed just yet.
I've read a couple of online tutorials about using the 4029, but haven't found anything specific about this situation.
I still don't know exactly what's going on. Only that it is. _________________ What makes a space ours, is what we put there, and what we do there.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum