UK Vintage Radio Repair and Restoration Powered By Google Custom Search Vintage Radio and TV Service Data

Go Back   UK Vintage Radio Repair and Restoration Discussion Forum > General Vintage Technology > Components and Circuits

Notices

Components and Circuits For discussions about component types, alternatives and availability, circuit configurations and modifications etc. Discussions here should be of a general nature and not about specific sets.

Closed Thread
 
Thread Tools
Old 7th Sep 2011, 11:42 am   #61
Amraduk
Hexode
 
Join Date: Jan 2007
Location: Welwyn Garden City, Hertfordshire, UK.
Posts: 453
Default Re: 4 Digit Up/Down Counter IC?

Hello Stephen,

Quote:
Originally Posted by val33vo View Post
Just forgot to mention that you can get very keenly priced PIC micros at a company called Crownhill associates.
Thanks. I have seen their ads in various magazines but had forgotten about them!

Regards,

Dave.
Amraduk is offline  
Old 7th Sep 2011, 12:09 pm   #62
neon indicator
Retired Dormant Member
 
Join Date: Jun 2010
Location: Co. Limerick, Ireland.
Posts: 1,183
Default Re: 4 Digit Up/Down Counter IC?

They are very expensive.
neon indicator is offline  
Old 7th Sep 2011, 12:57 pm   #63
Andy Doz
Hexode
 
Andy Doz's Avatar
 
Join Date: Feb 2011
Location: Gloucestershire, UK.
Posts: 376
Default Re: 4 Digit Up/Down Counter IC?

Look at the Gemini range here:

http://www.redlion.net/Products/Digi...unterRate.html

I used to maintain equipment (particle accelerators) with these in. Rate shouldn't be an issue.
Andy Doz is offline  
Old 7th Sep 2011, 8:36 pm   #64
Amraduk
Hexode
 
Join Date: Jan 2007
Location: Welwyn Garden City, Hertfordshire, UK.
Posts: 453
Default Re: 4 Digit Up/Down Counter IC?

Hello Andy,

Thanks for the suggestion, though they are much too big, I'm afraid! I need a 4 digit display approx 30mm x 7mm.

Regards,

Dave.
Amraduk is offline  
Old 7th Sep 2011, 8:46 pm   #65
neon indicator
Retired Dormant Member
 
Join Date: Jun 2010
Location: Co. Limerick, Ireland.
Posts: 1,183
Default Re: 4 Digit Up/Down Counter IC?

They are also about £100
neon indicator is offline  
Old 7th Sep 2011, 11:48 pm   #66
Amraduk
Hexode
 
Join Date: Jan 2007
Location: Welwyn Garden City, Hertfordshire, UK.
Posts: 453
Default Re: 4 Digit Up/Down Counter IC?

Hello Michael,

Quote:
Originally Posted by neon indicator View Post
They are also about £100
I didn't go that far. That is far too much!

Regards,

Dave.
Amraduk is offline  
Old 8th Sep 2011, 2:51 pm   #67
mhennessy
Dekatron
 
Join Date: Jul 2007
Location: Evesham, Worcestershire, UK.
Posts: 4,241
Default Re: 4 Digit Up/Down Counter IC?

Hello Dave,

I had a bit of a play over lunch, and this is what I turned up...

It's a simple "proof of concept", using bits from our PIC teaching equipment. I'm using the PIC16F84 to drive the multiplexed 7-segment display and count pulses (produced from switches because we don't have any rotary encoders here at the moment).

The code is 133 words (891 free), and only 7 variables are in use. It's fair to say that this most lowly of PICs is somewhat over-specified

I've made no attempt to optimise things; what you see is rough and ready, but working. As we still don't know what the maximum count frequency will be, it's hard to test it further, but seeing as this is replacing a mechanical counter, I guess it's a bit arbitrary really.

As a learning exercise you'll probably want to write your own code, but this might help to get you started. On the other hand, now that I've gathered everything together in one place, I'm happy to work with you and finish this now. I haven't written the routines to save the count value to EEPROM - doing so might require a PIC with more I/O and an external power-fail circuit (assuming Microchip haven't built this in yet).

As it happens, I'm going to set this as an exercise for our more able students in future. We only get 4 days with them, so this is about as far as we can take things in that time, but occasionally we get people who have done this before and need stretching...

Comments welcome, but please bear in mind everything above, and only if they're constructive. Please remember, this was about 30 minutes work in a lunch-break

Sorry about the dim LEDs (they are ancient), and the .txt file ought to be .asm

Cheers,

Mark

EDIT: When the comments in the code say "NPN", they should say "PNP". I used 2N3906, but almost anything will do...
Attached Thumbnails
Click image for larger version

Name:	IMG_4024.jpg
Views:	122
Size:	111.2 KB
ID:	56005   Click image for larger version

Name:	IMG_4025.jpg
Views:	108
Size:	91.6 KB
ID:	56006  
Attached Files
File Type: txt Counter.txt (13.1 KB, 247 views)
mhennessy is offline  
Old 8th Sep 2011, 4:05 pm   #68
jimmc101
Heptode
 
jimmc101's Avatar
 
Join Date: Mar 2009
Location: Portsmouth, Hampshire, UK.
Posts: 674
Default Re: 4 Digit Up/Down Counter IC?

That's quick, I think you're right about I/O; another interrupt for 'power-fail' would really be useful.

How about changing to a 16F628A and using the internal oscillator option.
This would free RA 0 1, 2 , 3 ,4(!Open drain), 6 & 7 for the segment drives. (RA 5 is input only).
Using RB 0, 1, 2, 3 for the digit drives leaves RB 4 & 5 for the encoder and RB 6 for the power-fail line.
RA 5 or RB 7 could be used for a 'Zero' button.
Using 'interrupt on change' of RB 4 to 7 allows both both the encoder and power fail to be interrupt driven.
As an additional benefit all four edges of the encoder could be decoded allowing up to four times the count per revolution of the encoder.


Jim
jimmc101 is offline  
Old 8th Sep 2011, 4:32 pm   #69
Amraduk
Hexode
 
Join Date: Jan 2007
Location: Welwyn Garden City, Hertfordshire, UK.
Posts: 453
Default Re: 4 Digit Up/Down Counter IC?

Hello Mark,

Quote:
Originally Posted by mhennessy View Post
I had a bit of a play over lunch, and this is what I turned up...
It's very interesting, thanks for taking the time to do that!

Quote:
It's a simple "proof of concept", using bits from our PIC teaching equipment. I'm using the PIC16F84 to drive the multiplexed 7-segment display and count pulses (produced from switches because we don't have any rotary encoders here at the moment).
That isn't important at this stage, the rotary encoder can wait.

Quote:
The code is 133 words (891 free), and only 7 variables are in use. It's fair to say that this most lowly of PICs is somewhat over-specified
Which just goes to show that a more powerful PIC isn't required!

Quote:
I've made no attempt to optimise things; what you see is rough and ready, but working. As we still don't know what the maximum count frequency will be, it's hard to test it further, but seeing as this is replacing a mechanical counter, I guess it's a bit arbitrary really.
I have no idea how fast the spools rotate during fast winding, I'll have to see if I can devise a method for measuring it.

Quote:
As a learning exercise you'll probably want to write your own code, but this might help to get you started.
I'm sure it will, and yes, I would like to write my own code as I expect I'll learn more that way.

I can more-or-less follow the listing you provided, though there are parts that will need some explanation.

Quote:
On the other hand, now that I've gathered everything together in one place, I'm happy to work with you and finish this now.
Thanks, I dare say I'll be asking questions!

Quote:
I haven't written the routines to save the count value to EEPROM - doing so might require a PIC with more I/O and an external power-fail circuit (assuming Microchip haven't built this in yet).
Again, that's not so needed at this stage, proving the concept is the important thing. I wouldn't be surprised if they have included power-fail option in one of their later PICs.

Quote:
Sorry about the dim LEDs
No problem, they show the count well enough.

Quote:
When the comments in the code say "NPN", they should say "PNP". I used 2N3906, but almost anything will do...
Noted about PNP! I'm sure I'll have a suitable transistor at hand for switching the 7-segment LEDs.

Regards,

Dave.
Amraduk is offline  
Old 8th Sep 2011, 4:58 pm   #70
mhennessy
Dekatron
 
Join Date: Jul 2007
Location: Evesham, Worcestershire, UK.
Posts: 4,241
Default Re: 4 Digit Up/Down Counter IC?

Hi Jim,

Yes, all good points. I only used 16F84 because that's what these old training kits were designed around (and to be honest, it's not worth changing to anything else for what we do in 4 days). I've got a couple of 16F827As here, which are very similar to the '628A, so could experiment further...

Good point about the reset button - I forgot to mention it above or in the code, but in the absence of a spare input, I thought I'd use /MCLR (which feels like "cheating" somehow ). This would be fine as the code stands now, but obviously wouldn't work for the EEPROM version (the 16F84A doesn't have a PCON register to allow you to differentiate from power-on reset and /MCLR reset).

I used the RB4-7 IRQ for the rotary encoder for my preamp, thinking along the same lines. In the end, I found that doing it the "simple" way (like this code does) was fine for that, but as the pulse speed could be higher here, that's a useful option to reserve.

The 4MHz internal oscillator should be fine if it can keep up with the incoming pulses. We really need more information about this (Dave, that's a gentle hint )

Mark
mhennessy is offline  
Old 8th Sep 2011, 5:01 pm   #71
davegsm82
Heptode
 
davegsm82's Avatar
 
Join Date: Jan 2004
Location: Blyth, Northumberland, UK.
Posts: 858
Default Re: 4 Digit Up/Down Counter IC?

You could find your maximum count speed by attaching a frequency counter to the least significant bit of the rotary encoder (I presume its one of those 'grey code' counters, as opposed to binary) and then winding your spools forward and backward.

The LSB will change most often and will be an indicator of the highest count rate.

Dave.
davegsm82 is offline  
Old 8th Sep 2011, 5:09 pm   #72
mhennessy
Dekatron
 
Join Date: Jul 2007
Location: Evesham, Worcestershire, UK.
Posts: 4,241
Default Re: 4 Digit Up/Down Counter IC?

Hi Dave,

It'll be a quadrature encoder, so two square wave outputs 90 degrees out of phase. These encoders have a variable number of cycles per revolution; the one I used gives 128 per revolution. So to find the frequency, multiply that by spool speed.

I said "it'll be" because I don't think it's been selected and installed yet. Looking at the first post, the current device is mechanical - meaning Dave has some work to do - and my advice would be to choose the fewest cycles per revolution. In fact, I'd be tempted to DIY something, especially given the cost of quadrature encoders . A lot of old VCRs used these under the spool tables - they were reflective foil with black segments, and a pair of IR LEDs/phototransistors underneath - these could easily be modified for this application...

Cheers,

Mark
mhennessy is offline  
Old 8th Sep 2011, 5:16 pm   #73
davegsm82
Heptode
 
davegsm82's Avatar
 
Join Date: Jan 2004
Location: Blyth, Northumberland, UK.
Posts: 858
Default Re: 4 Digit Up/Down Counter IC?

Quote:
Originally Posted by mhennessy View Post

Hi Dave,

It'll be a quadrature encoder, so two square wave outputs 90 degrees out of phase. These encoders have a variable number of cycles per revolution; the one I used gives 128 per revolution. So to find the frequency, multiply that by spool speed.
Yes, I *think* (although not sure) thats called the "Grey" code, truth table;

X AB
0 00
1 01
2 11
3 10

You'll notice it differs slightly from binary, it gets really confusing with more than 2 bits.

I remember seeing those silver and black foil encoders on the bottom of video deck's, quite clever little things, espeially when you consider that the opto's were on the PCB facing upwards and the distance between them was engineered in!

Dave.
davegsm82 is offline  
Old 8th Sep 2011, 5:37 pm   #74
ppppenguin
Retired Dormant Member
 
ppppenguin's Avatar
 
Join Date: Dec 2003
Location: North London, UK.
Posts: 6,168
Default Re: 4 Digit Up/Down Counter IC?

Gray Code http://en.wikipedia.org/wiki/Gray_code

The idea is that only 1 bit changes at any step so you are never left wondering if another bit should have changed at that step. Widely used for shaft encoders for that reason.
ppppenguin is offline  
Old 8th Sep 2011, 5:41 pm   #75
mhennessy
Dekatron
 
Join Date: Jul 2007
Location: Evesham, Worcestershire, UK.
Posts: 4,241
Default Re: 4 Digit Up/Down Counter IC?

Hi Dave,

Yes, you're right, the output is, strictly speaking, a Grey code because only one bit changes with each state. But with 2 bit Grey codes, there is no MSB and LSB; they both have the same frequency. Physically, it's just the spacing of the opto-couplers around the circumference of the spinning disc that gives the 90 degree phase shift. (That's yet another variable that had to be designed into VCRs - never underestimate the skill involved with production engineering )

Grey codes are used for absolute position sensors, with many more bits - as you say, these get very confusing indeed

Attached is another example - I rescued this with a view to DIYing something (again, rotary encoders are very expensive to buy - the one I used in my preamp now costs £50 ). This one came from an old Thorn lighting desk - the operator would drive this by sliding a fingertip on the toothed belt (all rotting away now) on the top surface, which in turn spins the disc. The light source (4 LEDs) is clearly visible on the small PCB, and the photo-transistors are just visible under the disc. I reckon I could mount that disc on the end of a tuning drive spindle, and use it with some slotted opto-isolators or similar...

Cheers,

Mark
Attached Thumbnails
Click image for larger version

Name:	IMG_4026.jpg
Views:	86
Size:	95.3 KB
ID:	56011  
mhennessy is offline  
Old 8th Sep 2011, 6:16 pm   #76
Brian R Pateman
Nonode
 
Brian R Pateman's Avatar
 
Join Date: Jun 2005
Location: Western Lake District, Cumbria (CA20) - UK
Posts: 2,136
Default Re: 4 Digit Up/Down Counter IC?

This seems like taking a very large sledgehammer to crack a very small nut.

Encoders are not necessary, a simple magnet on the turntable, a cheap hall effect sensor and one of these would do the job at the cost of about £25.

I've attached the datasheet for the counter.

Forgive me if I sound like a Luddite, I just find simple low cost solutions preferable to expensive complexity and rather more elegant.
Attached Files
File Type: pdf Trumeter7401ASDatasheet.pdf (74.8 KB, 91 views)
__________________
Brian
Brian R Pateman is offline  
Old 8th Sep 2011, 6:22 pm   #77
ppppenguin
Retired Dormant Member
 
ppppenguin's Avatar
 
Join Date: Dec 2003
Location: North London, UK.
Posts: 6,168
Default Re: 4 Digit Up/Down Counter IC?

Quote:
Originally Posted by Brian R Pateman View Post
Encoders are not necessary, a simple magnet on the turntable, a cheap hall effect sensor and one of these would do the job at the cost of about £25.
I agree that looks like a nice simple solution and saves re-inventing the wheel. Perhaps I'm being thick, but how would this know which direction it is rotating and hence whether to increment or decrement the count.
ppppenguin is offline  
Old 8th Sep 2011, 6:23 pm   #78
mhennessy
Dekatron
 
Join Date: Jul 2007
Location: Evesham, Worcestershire, UK.
Posts: 4,241
Default Re: 4 Digit Up/Down Counter IC?

Hi Brian,

The only problem with this is detecting the direction of rotation for counting down. Perhaps a second hall sensor might work? EDIT: Hmm - probably not...

The OP has stated that he doesn't want to hook into the mechanism to detect when it's being driven in reverse. Also, R2R tape machines might be driven by hand when editing, which is another reason to use a quadrature encoder.

The code is already there (though has plenty of scope for enhancements) - indeed I could send him a programmed PIC. If the encoder could be DIYed, and he already has the miscellaneous bits (like the LED displays, etc) then it's a very cheap project so far

Mark
mhennessy is offline  
Old 8th Sep 2011, 7:10 pm   #79
jimmc101
Heptode
 
jimmc101's Avatar
 
Join Date: Mar 2009
Location: Portsmouth, Hampshire, UK.
Posts: 674
Default Re: 4 Digit Up/Down Counter IC?

What about recycling the bits from an old mouse? e.g. http://members.shaw.ca/swstuff/mouse.html
For one or more pulses / turn it's easy enough to make your own replacement disk with only one or more slots or vanes.

(Yes I am a cheapskate )

Jim

p.s. If the site seems to ring a bell think ESR meters
jimmc101 is offline  
Old 8th Sep 2011, 7:32 pm   #80
mhennessy
Dekatron
 
Join Date: Jul 2007
Location: Evesham, Worcestershire, UK.
Posts: 4,241
Default Re: 4 Digit Up/Down Counter IC?

Hi Jim,

Love it! It's something I've often wondered about (as the collection of mice in the attic will attest), but it appears that this guy has a bigger collection of round tuits than me

There you are, Dave; no shortage of money-saving ideas

I reckon the reflectors from an old VCR might be the best bet as these probably wouldn't need dividing down - but dividing down can be done in software if required...

Mark
mhennessy is offline  
Closed Thread

Thread Tools



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


All information and advice on this forum is subject to the WARNING AND DISCLAIMER located at https://www.vintage-radio.net/rules.html.
Failure to heed this warning may result in death or serious injury to yourself and/or others.


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