UK Vintage Radio Repair and Restoration Discussion Forum

UK Vintage Radio Repair and Restoration Discussion Forum (https://www.vintage-radio.net/forum/index.php)
-   Components and Circuits (https://www.vintage-radio.net/forum/forumdisplay.php?f=40)
-   -   4 Digit Up/Down Counter IC? (https://www.vintage-radio.net/forum/showthread.php?t=73694)

Amraduk 2nd Sep 2011 4:56 pm

4 Digit Up/Down Counter IC?
 
I'm planning on building a 4-digit electronic "turns counter" to replace the broken mechanical one in my Revox tape recorder. I have searched for a suitable IC that will take in the quadrature o/p of a shaft encoder and output drive for a 7-segment LED display but not had any success. I've only been able to find either obsolete ICs or ones that don't fit all the requirements. Does anyone here know of any suitable currently available ICs?

Regards,

Dave.

mhennessy 2nd Sep 2011 7:31 pm

Re: 4 Digit Up/Down Counter IC?
 
I can't think of a single chip that would do this, although it could be done with TTL or CMOS logic. However, this would be an idea project to learn about PIC processors - I reckon this could be done really very easily. I built a hi-fi preamp that uses a rotary encoder for volume/menu functions, and found that it was pretty easy to work with.

A nice feature; most PICs have non-volatile flash RAM, so you could save the value in there when it gets powered down, meaning the value would be retained...

If I had more spare time, I'd offer to write the code for you - sadly life is just too busy, but I'm willing to help in any way I can. There's a PIC guide on my site, if that helps.

Good luck,

Mark

Guest 2nd Sep 2011 7:46 pm

Re: 4 Digit Up/Down Counter IC?
 
You can get electromechanical counters from Farnell, they have a relay type coil that drives the counter.

mhennessy 2nd Sep 2011 7:59 pm

Re: 4 Digit Up/Down Counter IC?
 
...would that keep up with fast spooling? The ones I've seen are pretty rapid ;)

Amraduk 2nd Sep 2011 8:42 pm

Re: 4 Digit Up/Down Counter IC?
 
Hello Mark,

Thanks for your reply.

Quote:

Originally Posted by mhennessy (Post 462333)
I can't think of a single chip that would do this, although it could be done with TTL or CMOS logic.

Indeed, it could, and I was initially thinking along those lines but I found an IC that will take in the quadrature o/p of the encoder and do the necessary logic for producing the up/down signal but it only outputs a binary result, not as drive for a 7-segment LED display, hence my enquiry!

Quote:

However, this would be an idea project to learn about PIC processors - I reckon this could be done really very easily.
I've read that a PIC might not keep up, though, IIRC, it was for a different application, so may not apply in this case. However, I would need to be certain that it would, before going down that route!

Quote:

A nice feature; most PICs have non-volatile flash RAM, so you could save the value in there when it gets powered down, meaning the value would be retained...
That would be a very useful feature, I was wondering how I could do that with a single chip solution. If I were go with TTL or CMOS logic, I suppose that might be easier to implement.

Quote:

If I had more spare time, I'd offer to write the code for you - sadly life is just too busy, but I'm willing to help in any way I can. There's a PIC guide on my site, if that helps.
Thanks for your offer to help, I haven't used PICs so far, which is another reason I wasn't considering that route, but that's something I intend to rectify at some point, though it might not be for a while. I'll take a look at your site to see if it gives me any ideas.

The only thing I'm unsure about, is how many pulses per revolution, though based on the mechanical counter, which incremented by approx one per rev, I guess that it would have to be the same.

Regards,

Dave.

Amraduk 2nd Sep 2011 8:50 pm

Re: 4 Digit Up/Down Counter IC?
 
Quote:

Originally Posted by merlinmaxwell (Post 462336)
You can get electromechanical counters from Farnell, they have a relay type coil that drives the counter.

Thanks for your reply.

I wanted to keep away from mechanical devices as far as possible! ;) Mike (mhennessy) is probably right that it wouldn't keep up and I would think that it would be too big for the available space.

Regards,

Dave.

evingar 2nd Sep 2011 8:58 pm

Re: 4 Digit Up/Down Counter IC?
 
I'd take the CPLD approach.

My fav for small DIY jobs is the "retro" Altera 7000 family :-

http://uk.farnell.com/altera/epm7064...lcc/dp/1637255


You can fit it in a PLCC PTH socket, so wiring it is easy on patch board. Altera do free S/W, you can serially program it with a DIY pod running from an old PC parallel port.


https://www.altera.com/download/software/quartus-ii-we

http://www.altera.com/literature/ug/...byte%20blaster


You don't need to know any programming language, you can "drag and drop" TTL elements to make up your required logic.

It will give you the "1 chip solution" you require, and is very easy to modify the logic without having to get the soldering iron out each time.

mhennessy 2nd Sep 2011 9:12 pm

Re: 4 Digit Up/Down Counter IC?
 
Hi Dave,

Quote:

Originally Posted by Amraduk (Post 462357)
Quote:

Originally Posted by mhennessy (Post 462333)
I can't think of a single chip that would do this, although it could be done with TTL or CMOS logic.

Indeed, it could, and I was initially thinking along those lines but I found an IC that will take in the quadrature o/p of the encoder and do the necessary logic for producing the up/down signal but it only outputs a binary result, not as drive for a 7-segment LED display, hence my enquiry!

Ahh - you didn't say that! In that case you need a binary to BCD converter. Used to be done with discrete logic, but I think there might be chips that do some of the work for you (I never used them), although for this I'd use a PIC* - a really simple bit of code could decode the binary input and display it on a multiplexed LED display.

To be honest though, the quadrature decoding is little more than a D-type latch, so the chip you've found doesn't really save much. You'd be better making your own counter that can count in BCD, which would then simply need decoding to drive the 7-segment display. But it amounts to around 10 ICs in total - I would have considered going down this route before I learnt to programme PICs, but no chance now ;)


Quote:

I've read that a PIC might not keep up, though, IIRC, it was for a different application, so may not apply in this case. However, I would need to be certain that it would, before going down that route!
Yes, we'd need to establish the highest clock speed. Although this could easily be divided down by 2 or 4 with a single 74HC74 or 4013 before feeding it to a PIC. Failing that, programmable logic could be used - I've done simple things like this in the past...

For what it's worth, the encoder on my preamp outputs 128 pulses per revolution, and keeps up with any rotation that you can do by hand. I've never tried spinning it with a drill or similar to see what happens when it gets too fast (there's an idea ;))


Quote:

Quote:

A nice feature; most PICs have non-volatile flash RAM, so you could save the value in there when it gets powered down, meaning the value would be retained...
That would be a very useful feature, I was wondering how I could do that with a single chip solution. If I were go with TTL or CMOS logic, I suppose that might be easier to implement.
It would be harder with CMOS logic and rather less practical with TTL logic. The PIC would do it in software, so no need for backup batteries or capacitors.

Good luck,

Mark

* Other programmable microcontrollers are available ;D

Amraduk 2nd Sep 2011 9:38 pm

Re: 4 Digit Up/Down Counter IC?
 
Hello Chris,

Thanks for your reply.

Quote:

Originally Posted by evingar (Post 462364)
I'd take the CPLD approach.

My fav for small DIY jobs is the "retro" Altera 7000 family :-

You don't need to know any programming language, you can "drag and drop" TTL elements to make up your required logic.

It will give you the "1 chip solution" you require, and is very easy to modify the logic without having to get the soldering iron out each time.

This looks very promising! What about 'non-volatile memory', can it be implemented in this series of devices?

I will take a look at the links you provided to see what's involved.

Regards,

Dave.

Amraduk 2nd Sep 2011 9:54 pm

Re: 4 Digit Up/Down Counter IC?
 
Hello Mark,

Thanks for your further reply. The solution proposed by Chris (evingar) looks very promising! Particularly because the programming s/w is free and one doesn't need to learn a programming language! ;)

I agree that the quadrature decoding is only a small part but it would be one less thing to have to do!

Regards,

Dave.

ppppenguin 3rd Sep 2011 8:22 am

Re: 4 Digit Up/Down Counter IC?
 
I would do it in a CPLD, probably a Xilinx Coolrunner because thy are the ones I know best. You can get little DIL modules with the SM chip fitted though I've never actually used one.

I've not done anything with PICs but they sound just right for the job. We're not talking about anything very fast, this is a kHz problem, not a MHz one, even at high rotational speeds.

mhennessy 3rd Sep 2011 8:42 am

Re: 4 Digit Up/Down Counter IC?
 
Hi Dave,

Indeed, I did suggest programmable logic in my last reply, but I didn't go into details because the devices I used were older, and the software that went with them was far from easy, and I was aware that I'd be giving you old information. The only way to programme them was to derive long logic equations, and the software was amazingly clunky. Happily, things seem to have vastly improved, based on the information in Chris's post...

This is an interesting question, BTW. When a problem like this comes along, the first question is always "microcontroller or programmable logic?". And to answer the question, you consider factors such as complexity vs operating speed. For example, my hi-fi preamp could have been done in programmable logic at a push (although not by me ;)). But a microcontroller was a no-brainer. Something like a video test card generator, that requires high processing speeds, is normally best done with programmable logic - again, that's generally pretty clear-cut. But your application is one of those "grey areas". The complexity is minimal, but so are the operating speeds. Based on what I know of the problem at this stage, I'd say either device would be equally practical, and it's a matter of personal preference. I'd choose a PIC simply because I know how to programme them. But as you are starting from scratch, you can choose the solution that's easiest ;)

BTW, the software for PIC programming is completely free as well. And the programming hardware is DIY, hanging off a serial port (though many people, including Velleman, produce kits for not much money). Parallel ports and USB are an option too.

I don't know if these things have non-volatile memory; certainly the older ones didn't. Also, the older ones were rather power-hungry, making capacitor or battery backup impractical, but I'm sure they must be better in that regard these days. Chris?

Mentioning power consumption has reminded me; someone I know in BBC R&D used programmable logic to implement an MPEG video encoder. I can't begin to appreciate the level of complexity and skill involved, but he was amazingly modest about it! But why got to all this effort when MPEG encoder chips are readily available? Because the PLD solution was much more power efficient, and this was for a portable battery-operated device. OT, I know, but gives you some idea of what can be done :)

Cheers,

Mark

Amraduk 3rd Sep 2011 9:55 pm

Re: 4 Digit Up/Down Counter IC?
 
Jeffrey and Mark, thanks for your comments and suggestions. I will have to investigate the alternatives to see what are the pros and cons!

I would appreciate it if you could point me to the free s/w and DIY programming h/w for both PICs and CPLDs, thanks.

Regards,

Dave.

evingar 3rd Sep 2011 10:08 pm

Re: 4 Digit Up/Down Counter IC?
 
Quote:

Originally Posted by Amraduk (Post 462383)

This looks very promising! What about 'non-volatile memory', can it be implemented in this series of devices?



Regards,

Dave.

No, unfortnately not. If you want anything to survive on power down, the device would have to be maintained with a NiCad (etc).

ppppenguin 3rd Sep 2011 10:18 pm

Re: 4 Digit Up/Down Counter IC?
 
The Xilinx webpack free software will allow you program all their CPLDs and many of smaller FPGAs. Simple parallel port programming hardware can be built easily.

Top Cap 3rd Sep 2011 10:46 pm

Re: 4 Digit Up/Down Counter IC?
 
1 Attachment(s)
Pity you could not engineer-in something like the attached, using the FF and RW keys to determine whether to count up or down. I have seen much smaller counters even with full panel mount capability but they only count up :(. Perhaps you could find a suitable panel bezel for it to fit behind whilst using a suitable supporting back board. At least it will hold the display/accumulated pulses when the machine is turned off and no need to provide any special power rails as it runs on an external Lithium battery. The only drawback may be cost as I have not a clue as to how much this meter is. You would have to take account of the possible savings to be made over the cost of alternative methods.
Les

Amraduk 4th Sep 2011 12:03 am

Re: 4 Digit Up/Down Counter IC?
 
Hello Les,

Thanks for your suggestion. The cost from the manufacturer of the device you mentioned is $46, I think it could be done for less, using programmable logic.

I also need only four digits, so 4 of the 8 in this device would be wasted. The dimensions needed for the display are approximately 30mm x 7mm, 4 of the digits on this device are approximately 16mm wide (about 4mm per digit), so too small, I'm afraid.

I would rather keep the direction sensing away from the transport controls, and would prefer it to come from the shaft encoder, which I will still need anyway.

Regards,

Dave.

Amraduk 4th Sep 2011 12:08 am

Re: 4 Digit Up/Down Counter IC?
 
Hello Chris,

Quote:

Originally Posted by evingar (Post 462643)
No, unfortnately not. If you want anything to survive on power down, the device would have to be maintained with a NiCad (etc).

That's a pity! Thanks for the info.

Regards,

Dave.

Amraduk 4th Sep 2011 12:10 am

Re: 4 Digit Up/Down Counter IC?
 
Hello Jeffery,

Quote:

Originally Posted by ppppenguin (Post 462646)
The Xilinx webpack free software will allow you program all their CPLDs and many of smaller FPGAs. Simple parallel port programming hardware can be built easily.

OK. Thanks for that information.

Regards,

Dave.

ppppenguin 4th Sep 2011 8:43 am

Re: 4 Digit Up/Down Counter IC?
 
Here's an example of a low cost Xilinx Coolrunner based module. There are others but I don't have links to hand:

http://shop.trenz-electronic.de/cata...ucts_id=77&SID

One warning about using Xilinx (or later Altera) software. While it is theoretically possible to design using schematic entry in practice it's a gesture to make you wish you'd learned VHDL instead. I don't want to put you off but VHDL is a hideous language. However once you've got to grips with it you will find it very pwoerful and flexible. There are a couple of us here in UKVRR who are at least adequately up to speed with it and will help all we can. As an example here's the code fragment for an up/down counter which is more or less self explanatory. There are several subtle points to note but this gives you the general idea.

Code:

process (CK) begin
    if rising_edge(CK) then   

        if COUNTER_RESET then COUNT <= 0; 
            elsif COUNT_MODE = COUNT_DOWN then COUNT <= COUNT -1;
            else        COUNT <= COUNT + 1;
        end if;

    end if; --CK
end process;



All times are GMT +1. The time now is 1:33 pm.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright ©2002 - 2023, Paul Stenning.