Help needed with CD4059 divide by N counter

donrecardo

Senior Member
Hi
I am sorry that this isnt about a Picaxe problem but I know from the time I have been
on this forum that there are many clever people on here and maybe one of them
might be able to assist me

I have a CD4059 divide by N counter chip

I have the data sheet and have studied it for hours but I still cant make top nor tail
of it with its Ka, Kb Kc and jam inputs

I want to use three BCD thumb wheel switches ( Hundreds , Tens and Units)
to enable me to divide an input frequency by any integer in the range of 3 to 150
which I would set up on the 3 switches
As I said , I have really tried but I just cant follow the reasoning in the data sheet
I think its probably an age thing now that I am an old bugger

Can someone please give me a diagram of how I should connect it up before I pull
out the little hair I have left

Fingers Crossed

Don
 

rq3

Senior Member
Hi
I am sorry that this isnt about a Picaxe problem but I know from the time I have been
on this forum that there are many clever people on here and maybe one of them
might be able to assist me

I have a CD4059 divide by N counter chip

I have the data sheet and have studied it for hours but I still cant make top nor tail
of it with its Ka, Kb Kc and jam inputs

I want to use three BCD thumb wheel switches ( Hundreds , Tens and Units)
to enable me to divide an input frequency by any integer in the range of 3 to 150
which I would set up on the 3 switches
As I said , I have really tried but I just cant follow the reasoning in the data sheet
I think its probably an age thing now that I am an old bugger

Can someone please give me a diagram of how I should connect it up before I pull
out the little hair I have left

Fingers Crossed

Don

NOOOOO!!!

Just kidding, Don. It's probably been almost 40 years since I used one of these for a VHF synthesizer, using CMOS, TTL, and ECL as the frequency in the synthesizer chain went towards 150 MHz.

Probably the best advice I can give is to remind you that this device is capable of fully static operation. This means that you can safely run it from a 9 volt transistor battery, give it a known clock at the clock input, and then pull the mode select and jam inputs high or low, manually, with wires on a breadboard going to ground or V+. There is no dynamic clocking required of the mode or jam inputs.

The nasty thing is that the final output is a CMOS pulse at the frequency you have set with the mode and jam inputs, but a WIDTH inversely proportional to the clock pulse width and the division ratio. In other words, you are programming the pulse repetition rate, but the output pulse WIDTH gets narrower and narrower in proportion to the division ratio. It can be very hard to see.

It's really, really old CMOS technology, and not capable of supporting a clock rate over about 1 MHz when run at 12 volts (if I recall correctly), but you'll still need a decent oscilloscope to see what the heck it is doing. With a 1 MHz clock, and a 15,999 division (again, the most it is capable of by my very aging memory), the output pulse would be roughly 62 picoseconds wide. Of course, based on the technology of the time, it was never capable of achieving anything like this, but you get the idea. It may indeed be working, and you just don't know it.

A flip-flop on the final CD4059 output is very useful to re-establish a 50% duty cycle, rather than having to deal with the very narrow pulse width.

I just have to ask. What possessed you to select this device?
 

donrecardo

Senior Member
I want to make a gear hobbing machine to make gears with ( my other hobby is model engineering)
A rotary table driven by a stepper motor holds a gear blank and the cutting hob is in the spindle of the milling
machine that has a rotary encoder fitted to it . I then need to make the rotary table turn at a precise ratio to the speed of the spindle
by dividing the encoder output by the chip. the division ratio governs the number of teeth it will cut on the gear blank

I chose the chip because someone else had done the same thing using the same chip. I intended to ask him to send me the circuit diagram
which he said he is willing to do , Unfortunately he seems to have changed his ISP so I cant contact him to ask for a copy.
I could do the same thing without a chip using Linux CNC software , that is , if I understood Linux. At my age I think trying to decipher
the chips data sheet might be easier than learning Linux

Don
 

rq3

Senior Member
I want to make a gear hobbing machine to make gears with ( my other hobby is model engineering)
A rotary table driven by a stepper motor holds a gear blank and the cutting hob is in the spindle of the milling
machine that has a rotary encoder fitted to it . I then need to make the rotary table turn at a precise ratio to the speed of the spindle
by dividing the encoder output by the chip. the division ratio governs the number of teeth it will cut on the gear blank

I chose the chip because someone else had done the same thing using the same chip. I intended to ask him to send me the circuit diagram
which he said he is willing to do , Unfortunately he seems to have changed his ISP so I cant contact him to ask for a copy.
I could do the same thing without a chip using Linux CNC software , that is , if I understood Linux. At my age I think trying to decipher
the chips data sheet might be easier than learning Linux

Don
Don, I will have to think on this, but I suspect you could do it directly with a picaxe. It would count spindle revolutions of the cutter directly, and then spit out a programmable number of step pulses every xyz revolutions of the spindle to step the indexing head. The xyz number would also be set by you, and would depend on the number of teeth for the gear you are cutting, and its modulus.

In effect, it would be a programmable indexing head, with a resolution of (2^16)^2?
 

fernando_g

Senior Member
Don;
I've actually used this chip in conjunction with a 08M, to create a 50 or 60 Hz timebase from a common 32.768 Khz clock.

I published the idea on Silicon Chip magazine, and after obtaining permission from the editor I posted the code in the snippets section, with the title: "Fractional frequency division".
Hope it helps you.
 

donrecardo

Senior Member
#rq3
Hi, After writing to you I was also thinking if it would be possible in software and a picaxe chip
I didnt spend long thinking it through because it was around 1.00AM and I was falling asleep.
Now I am awake again and thinking about it I couldnt help think my idea is so simple it cant be right
but then I couldnt see why not.
My thought train was
my indexer (rotary table) needs 40 turns of the handle to make it rotate once
my stepper motor needs 200 pulses to rotate once so I need 40 * 200 = 8000 pulses to rotate the indexer one revolution
If I put an encoder on the top of the mill spindle , lets say it gives 4000 pulses per revolution
now lets say I want a ten tooth gear ( thats the smallest I would ever cut) so I need to rotate the indexer
at 1/10th the speed of the spindle so for every ten turns of the spindle the indexer must rotate once
Or for every 40000 output pulses from the encoder ( 10 * 4000 ) the stepper motor needs to receive 8000 ( 200 * 40 ) pulses
Put another way it needs to output 1 pulse for every 5 pulses it receives
If I take a variable and set it to 5 , and each time I receive a pulse from the encoder I decrement it by one till it
reaches zero , reset the variable and give an output pulse, So far so good if I set the variable to half the number of gear teeth required I get the right answer,
but then I realised why this is not so easy, suppose I want an odd number of teeth say 21 teeth , I cant set the variable to 10.5 and still decrement by
1 till I reach zero
If I made the encoder give 8000 pulses per spindle revolution ( the same number as the pulses required to move the indexer one revolution) then the variable could take
the value of the teeth to be cut. For a 21 tooth gear just count the pulses and when the variable reaches zero reset it and give an output to the stepper, This would now work
for both odd and even numbers
The only problem I see is , the spindle could be running at say 250 - 500 RPM so would output pulses at 33Khz to 66Khz , could the picaxe count ,
decrement the variable and output pulses fast enough to keep up ?

Aside from all that , as I already have the chips and switches I would still like to know how to wire the chips up to BCD thumb switches so as to be able to input a divide rate
if not for this project then maybe for something else

Regards
Don
 

donrecardo

Senior Member
Don;
I've actually used this chip in conjunction with a 08M, to create a 50 or 60 Hz timebase from a common 32.768 Khz clock.

I published the idea on Silicon Chip magazine, and after obtaining permission from the editor I posted the code in the snippets section, with the title: "Fractional frequency division".
Hope it helps you.
This sounds interesting , where do I find the snippets section?

Don
 

hippy

Ex-Staff (retired)
as I already have the chips and switches I would still like to know how to wire the chips up to BCD thumb switches so as to be able to input a divide rate
if not for this project then maybe for something else
From the CD4059 datasheet; for a divide by 10 first stage and a count range up to 9999, Ka=1, Kb=1, Kc=0.

For the BCD inputs it seems the connections are -

20 = J1, J5, J9, J13
21 = J2, J6, J10, J14
22 = J3, J7, J11, J15
23 = J4, J8, J12, J16

These are active high inputs. If the BCD switch output 20 shorts to common when "1" is selected; common to +V and use pull-downs, else common to 0V and use pull-ups.

It seems to be a counter so setting "9000" means 1000 counts until it overflows (or something like that), so it needs to be set to "1000" to get 9000 counts to overflow, but the BCD switches are to be set to how many wanted, not the preset value.

Best bet would seem to build it on breadboard and test it.
 
Last edited:

MartinM57

Moderator
So an electronic version of a hobber like https://www.youtube.com/watch?v=ZpJOEj-kX_o ?
...but you seem to describe a system where, simplistically, the rotary table just rotates slower than the mill spindle by some division factor

I'm struggling to picture how that hobs a gear using a vertical milling machine?...but I'm a very novice model engineer ;)

...and encoders that give 4000 or 8000 pulses per revolution - do they exist?
 

donrecardo

Senior Member
So an electronic version of a hobber like https://www.youtube.com/watch?v=ZpJOEj-kX_o ?
...but you seem to describe a system where, simplistically, the rotary table just rotates slower than the mill spindle by some division factor

I'm struggling to picture how that hobs a gear using a vertical milling machine?...but I'm a very novice model engineer ;)

...and encoders that give 4000 or 8000 pulses per revolution - do they exist?
Maybe you are mixing up cutting gears with an involute cutter rather than a Hob
A hob looks more like a tap its like a spiral of cutting teeth so the blank has to rotate to
keep the cuts inline with cutting teeth and then cuts all the teeth in one pass , rather
than one tooth at a time as would happen with an involute cutter
you can see it in action on a vertical mill here
https://www.youtube.com/watch?v=ZhICrb0Tbn4

as for is an encoder made with 4000 or 8000 output, possibly not
but an encoder with 1024 definately is
make a belt drive gear box with 125 and 32 teeth pulleys and you get an
increase in speed of 3.90625 giving you 4000 pulses from a 1024 encoder
125/32 * 1024 = 4000

Don
 

donrecardo

Senior Member
Hi Bear
yes on there it refers to MEW 108 as having the circuit diagrams I need
and MEW 110 which had a correction to the artical in issue 108
As I mentioned in an earlier post , J stevenson was providing a link for a copy of the
needed pages from the article but sadly his link is no longer working
I think its about 4 or 5 pages long in MEW 108 and Mew 110 so if anyone could make a scan of those that would be great


@ donrecado,
May I suggest you have a look at 'Model Engineers Workshop' forum.

http://www.model-engineer.co.uk/forums/

Regards, Bear..
 

The bear

Senior Member
@donrecardo,
Apologies, I missed your post, regarding MEW.
I'm a member only of the MEW forum.
Bear..
 

rq3

Senior Member
#rq3
Hi, After writing to you I was also thinking if it would be possible in software and a picaxe chip
I didnt spend long thinking it through because it was around 1.00AM and I was falling asleep.
Now I am awake again and thinking about it I couldnt help think my idea is so simple it cant be right
but then I couldnt see why not.
My thought train was
my indexer (rotary table) needs 40 turns of the handle to make it rotate once
my stepper motor needs 200 pulses to rotate once so I need 40 * 200 = 8000 pulses to rotate the indexer one revolution
If I put an encoder on the top of the mill spindle , lets say it gives 4000 pulses per revolution
now lets say I want a ten tooth gear ( thats the smallest I would ever cut) so I need to rotate the indexer
at 1/10th the speed of the spindle so for every ten turns of the spindle the indexer must rotate once
Or for every 40000 output pulses from the encoder ( 10 * 4000 ) the stepper motor needs to receive 8000 ( 200 * 40 ) pulses
Put another way it needs to output 1 pulse for every 5 pulses it receives
If I take a variable and set it to 5 , and each time I receive a pulse from the encoder I decrement it by one till it
reaches zero , reset the variable and give an output pulse, So far so good if I set the variable to half the number of gear teeth required I get the right answer,
but then I realised why this is not so easy, suppose I want an odd number of teeth say 21 teeth , I cant set the variable to 10.5 and still decrement by
1 till I reach zero
If I made the encoder give 8000 pulses per spindle revolution ( the same number as the pulses required to move the indexer one revolution) then the variable could take
the value of the teeth to be cut. For a 21 tooth gear just count the pulses and when the variable reaches zero reset it and give an output to the stepper, This would now work
for both odd and even numbers
The only problem I see is , the spindle could be running at say 250 - 500 RPM so would output pulses at 33Khz to 66Khz , could the picaxe count ,
decrement the variable and output pulses fast enough to keep up ?

Aside from all that , as I already have the chips and switches I would still like to know how to wire the chips up to BCD thumb switches so as to be able to input a divide rate
if not for this project then maybe for something else

Regards
Don
Don, a Picaxe could easily count pulses at rates up to 200,000 or even 400,000 per second (if the picaxe is clocked correctly. Personally I think this idea is not only do-able, but you should do it. Right now. Immediately. Tonight. I like to build mechanical clocks, and the gear cutting has always been a major hassle. If you don't do this, I will. I have the steppers and drivers in a box,...um.... over here somewhere. If you do it, only Picaxe BASIC is involved, no Linux, or Unix, or C++, which is the only reason I can get away with using a Picaxe.

For the CD4059, you're on your own. I remember that it made my head hurt, and reviewing the data sheet after 4 decades brought flashbacks and withdrawal symptoms that I thought had been deeply buried in my subconscious.
 

rq3

Senior Member
#rq3
Hi, After writing to you I was also thinking if it would be possible in software and a picaxe chip
I didnt spend long thinking it through because it was around 1.00AM and I was falling asleep.
Now I am awake again and thinking about it I couldnt help think my idea is so simple it cant be right
but then I couldnt see why not.
My thought train was
my indexer (rotary table) needs 40 turns of the handle to make it rotate once
my stepper motor needs 200 pulses to rotate once so I need 40 * 200 = 8000 pulses to rotate the indexer one revolution
If I put an encoder on the top of the mill spindle , lets say it gives 4000 pulses per revolution
now lets say I want a ten tooth gear ( thats the smallest I would ever cut) so I need to rotate the indexer
at 1/10th the speed of the spindle so for every ten turns of the spindle the indexer must rotate once
Or for every 40000 output pulses from the encoder ( 10 * 4000 ) the stepper motor needs to receive 8000 ( 200 * 40 ) pulses
Put another way it needs to output 1 pulse for every 5 pulses it receives
If I take a variable and set it to 5 , and each time I receive a pulse from the encoder I decrement it by one till it
reaches zero , reset the variable and give an output pulse, So far so good if I set the variable to half the number of gear teeth required I get the right answer,
but then I realised why this is not so easy, suppose I want an odd number of teeth say 21 teeth , I cant set the variable to 10.5 and still decrement by
1 till I reach zero
If I made the encoder give 8000 pulses per spindle revolution ( the same number as the pulses required to move the indexer one revolution) then the variable could take
the value of the teeth to be cut. For a 21 tooth gear just count the pulses and when the variable reaches zero reset it and give an output to the stepper, This would now work
for both odd and even numbers
The only problem I see is , the spindle could be running at say 250 - 500 RPM so would output pulses at 33Khz to 66Khz , could the picaxe count ,
decrement the variable and output pulses fast enough to keep up ?

Aside from all that , as I already have the chips and switches I would still like to know how to wire the chips up to BCD thumb switches so as to be able to input a divide rate
if not for this project then maybe for something else

Regards
Don
Don, one other odd thought has occured to me after your request for info on the CD4059 (thank you very much). Again, from ancient memory, the CD4059 is not really a divider, it's a counter, and it uses an odd "pulse swallowing" technique. When used in a phase locked loop (its "intended" application) the loop filter effectively removes this glitch. The missing pulses are averaged over time in the loop filter, and only show up as side-bands (phase noise) in the final spectrum.

When used to divide an actual digital pulse train, and then drive something like a stepper motor, which will respond to each and every pulse (or NOT respond to a missing pulse), the stepper will sometimes skip a step simply because the counter has swallowed it to keep the average frequency. This probably won't amount to a hill of beans in your gear hobb (say missing one step out of 32,000), but be aware that it is a necessary artifact of the way that the CD4059 works.
 

donrecardo

Senior Member
Don, a Picaxe could easily count pulses at rates up to 200,000 or even 400,000 per second (if the picaxe is clocked correctly. Personally I think this idea is not only do-able, but you should do it. Right now. Immediately. Tonight. I like to build mechanical clocks, and the gear cutting has always been a major hassle. If you don't do this, I will. I have the steppers and drivers in a box,...um.... over here somewhere. If you do it, only Picaxe BASIC is involved, no Linux, or Unix, or C++, which is the only reason I can get away with using a Picaxe.

For the CD4059, you're on your own. I remember that it made my head hurt, and reviewing the data sheet after 4 decades brought flashbacks and withdrawal symptoms that I thought had been deeply buried in my subconscious.
I had to smile when you wrote " Personally I think this idea is not only do-able, but you should do it. Right now. Immediately. Tonight."
It was turned midnight before your post arrived , and I was asleep so no I didnt do it right away , and I still havent done it yet
You also said " If you don't do this, I will. I have the steppers and drivers in a box,"
Perhaps you should , then I can copy what you do,, I still havent given up on using the 4059 chip , I am hoping to get a copy of the two articles
from MEW108/110
I found out an LTC6900 which is a 1k to 20Mhz oscillator IC whose frequency is set with one resistor
I was thinking of making up a test set up with the oscillator , a bread board and some switches , then try to work out how the switching works
and wire it up .
As I can set the input frequency with the LTC6900 I can predict what the frequency should be at the output
Output = input / division setting, if the answer doesnt match then keep trying till I get the right answer
 

hippy

Ex-Staff (retired)
I found out an LTC6900 which is a 1k to 20Mhz oscillator IC whose frequency is set with one resistor
I was thinking of making up a test set up with the oscillator , a bread board and some switches , then try to work out how the switching works and wire it up .
You can also use a PICAXE to generate PWMOUT and feed that into the divider. I suspect it will be fairly easy to figure out the device with it in front of you on breadboard. BCD switches can be either active high or low, and there are only 8 options for the Ka-Kb-Kc inputs and only two of those would seem to suit a divide by 9999 option.

It's just that trying to figure it out from the datasheet alone is a bit complicated.
 

donrecardo

Senior Member
You can also use a PICAXE to generate PWMOUT and feed that into the divider. I suspect it will be fairly easy to figure out the device with it in front of you on breadboard. BCD switches can be either active high or low, and there are only 8 options for the Ka-Kb-Kc inputs and only two of those would seem to suit a divide by 9999 option.

It's just that trying to figure it out from the datasheet alone is a bit complicated.

Well you definately right about it being hard from just the data sheet. I have looked at it for hours trying to follow their examples but just
as I think i understand it, the next example tells me no you dont
 

premelec

Senior Member
I'm acquainted with gears but not specific cutting tools... i wonder if you could use a code wheel coupled either to the gear blank or printed on it [see earlier posts for codewheel generation program] and then index the blank according to the code wheel readings. This would give direct position readings... whatever works!
 

donrecardo

Senior Member
Hi
I understand what you are meaning but I think it would be rather low resolution as it would be limited by the number
of divisions you could mark on your code wheel
lets say you drew 100 divisions on the code wheel and while running the program it missed one of the marks
then your gear will be inaccurate by 1% but if you do it tje way we said earlier where you have 8000 pulses
per revolution the error if you missed one pulse is only 0.0125% which is 80 times less
I think you would need a rather large code wheel to put 8000 divisions on it with 2.7 minutes of arc between the divisions
and the program missed one then its only out bu 0.0125% which is 80 times more accurate
 
Last edited:

MartinM57

Moderator
If you're going to "stepper motor"ise your RT and have the (ex-) handwheel doing maybe 40rpm by my calcs for certain # of gear teeth and cutter pm (are RTs designed for that continuous use - they may be I suppose?)...
..wouldn't it be easier to do what the guy in the referenced youtube video did and use the stepper motor to drive the gearwheel directly and use micro-stepping to get the resolution?

(I appreciate I'm not helping you with your specific CD4059/PICAXE implementation :))
 

rq3

Senior Member
Hi
I understand what you are meaning but I think it would be rather low resolution as it would be limited by the number
of divisions you could mark on your code wheel
lets say you drew 100 divisions on the code wheel and while running the program it missed one of the marks
then your gear will be inaccurate by 1% but if you do it tje way we said earlier where you have 8000 pulses
per revolution the error if you missed one pulse is only 0.0125% which is 80 times less
I think you would need a rather large code wheel to put 8000 divisions on it with 2.7 minutes of arc between the divisions
and the program missed one then its only out bu 0.0125% which is 80 times more accurate
Don, here's a 13 bit (8192 pulses per revolution) shaft encoder for only $72. Cheapest I've found so far. There's another company offering a 23 bit absolute encoder for only $2700. The toughest and most expensive part of this project, whether CD4059 or Picaxe, is the encoder. These folks also seem to have an even less expensive part that will do up to 622,592 counts per revolution (which is ludicrous), but the sensor wheel is pretty big, and you get to mount the whole thing to your spindle drive.
http://www.rls.si/rm44-up-to-13-bit-encoder-base-unit

 
Last edited:

donrecardo

Senior Member
Don, here's a 13 bit (8192 pulses per revolution) shaft encoder for only $72. Cheapest I've found so far. There's another company offering a 23 bit absolute encoder for only $2700. The toughest and most expensive part of this project, whether CD4059 or Picaxe, is the encoder. These folks also seem to have an even less expensive part that will do up to 622,592 counts per revolution (which is ludicrous), but the sensor wheel is pretty big, and you get to mount the whole thing to your spindle drive.
http://www.rls.si/rm44-up-to-13-bit-encoder-base-unit

Actually I already have 3 encoders
one that does 500ppr
one that does 1000ppr which I could gear up to 4000
and one that has 32000 ppr with a quadrature output which I believe could give
me 128000 distinct steps per revolution if I needed it
 

rq3

Senior Member
Actually I already have 3 encoders
one that does 500ppr
one that does 1000ppr which I could gear up to 4000
and one that has 32000 ppr with a quadrature output which I believe could give
me 128000 distinct steps per revolution if I needed it
Don, Hippys post #9 in this thread is exactly right. I had to go find my old schematics, and retrieve a data sheet (the current one from Texas Instruments is the best).
I'm amazed these things are still available!

The "mode" and "jam" pins are just active high binary coded decimal inputs. Just make sure all of the mode and jam input pins are pulled down with 10K or 100K resistors, connect your five active high 4 bit BCD switches to the counters per the datasheet pin-out, and set the division ratio on the switches as required.

I think the confusion comes from the first "mode" counter, which has a 3 bit input (one bit of the first BCD switch is unused) and can only take division values of 10,8,5,4, or 2. The divide by 5 case is special, and requires a master re-set and three clock cycles before it will take effect. The first counter ALSO influences the LAST divide stage.

Physically, implementing this is trivial. Pull down the pins with resistors as above, connect the active high BCD thumbwheel switches to the mode and jam inputs, input a clock of less than 3MHz (for a 12 volt supply) at pin 1, and get the divided output at pin 23. Note that the Latch Enable (pin 2) must be grounded for the output to occur. If the latch enable is high, the output will also go high, and stay there, at the next clock cycle.

Again, if your clock is say, a 1 MHz square wave and you divide it by 1000, the output will be a stream of pulses at 1000 Hertz, but each pulse will only be as wide as the original input (0.5 microsecond). Putting that through a flip-flop will square it up if needed.

It's slowly coming back to me. Very slowly!
 
Last edited:

donrecardo

Senior Member
Cheers for that rq3 ( sorry I dont know your name)
I follow most of what you are saying its just this mode counter and the fact that the first counter
affects the last dividing stage . I can see how to wire the switches and how to set enables etc
its just how they work out which mode to use etc

Could you give me 2 examples of what the mode and jam inputs would be set to for say for example
1195 and 63
I think if I could see how those two numbers are set up I can look at the differences and maybe
then better understand how to get any number I want


[EDIT] At the risk of looking stupid I have had a go at working it out in the post below

Regards
Don
 
Last edited:

donrecardo

Senior Member
I probably have this all to pot but I shall give it a go

If I want to divide by 63

Choose Mode 10 ( not sure why you would choose one mode over another )

set the Ka = 1, Kb = 1, Kc = 0

Code:
J1  J2  J3  J4      J5  J6  J7  J8      J9  J10  J11  J12    J13  J14  J15  J16
 1   1   0   0       0   1   1   0       0    0    0    0      0    0    0    0
Or to divide by 6420 in mode 10

Code:
J1  J2  J3  J4      J5  J6  J7  J8      J9  J10  J11  J12    J13  J14  J15  J16
 0   0   0   0       0   1   0   0       0    0    1    0      0    1    1    0
[EDIT] Sorry when I typed it the binary number lined up with the jam pin numbers but for some reason have now lost all the spaces and no longer line up

[Hippy:Edit] Fixed that for you, hope you don't mind.

Is that correct or just a case of , " back to the drawing board"

Don
 
Last edited by a moderator:

rq3

Senior Member
I probably have this all to pot but I shall give it a go

If I want to divide by 63

Choose Mode 10 ( not sure why you would choose one mode over another )

set the Ka = 1, Kb = 1, Kc = 0

J1 J2 J3 J4 J5 J6 J7 J8 J9 J10 J11 J12 J13 J14 J15 J16
1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0

Or to divide by 6420 in mode 10

J1 J2 J3 J4 J5 J6 J7 J8 J9 J10 J11 J12 J13 J14 J15 J16
0 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0

[EDIT] Sorry when I typed it the binary number lined up with the jam pin numbers
but for some reason have now lost all the spaces and no longer line up

Is that correct or just a case of , " back to the drawing board"

Don
Exactly! I think you've got it! The modes affect the initial and final divisor, so place a limit on the division ratio. They would be most useful in a radio synthesizer, where you would want to toggle a single bit to offset the final frequency by a fixed known amount.

You can see where all of this is going. Pick a mode and hardwire it, then set the desired division on your thumbwheel BCD switches. Done!

Regards,
Rip

EDIT: On further thought, the mode will also affect the switch type. For a meaningful decimal input from a bank of BCD switches each reading from 0-9, mode 10 makes the most sense. Do the calculations for different modes, and I think you'll see what I mean. My head hurts.
 
Last edited:

donrecardo

Senior Member
Thanks for hanging in with me
I am going to be busy over the next few days but as soon as I get time
I will wire up some switches and see how it goes and of course I will let you
know the result
Thank you to you and all the others that gave me help

Don
 

donrecardo

Senior Member
Just a bit more confusion
I received today a copy of the original circuit that was published in Model Engineering Workshop issue 108

They seem to be doing it all arse about face compared to what we were thinking
They are dividing by 2 rather than 10
They are pulling all jam inputs high and using the thumb wheel switches to set the inputs low which I cant see how that can work
Surely as the inputs are active high then if the switches are common negative to set the number one in BCD you would have to
turn on bits for 2 4 and 8 leaving just '1' as high, and I dont see how you would do that with a thumb wheel switch

When I get some time I will make my test bed with the chip and a clock source and see what happens when I try both methods

Here is the original circuit

MEW108 circuit.jpg

Don
 

Buzby

Senior Member
Hi Don,

It's been a while since I used BCD thumbwheels, but I do remember that the ones we had provided 8 outputs, not 4. The first 4 were NO contacts, and the second 4 were NC contacts.

So if the schematic is using the second set then the results would be as expected.

Check your switches, they might have the same.

Cheers,

Buzby

EDIT : See page 3 of this datasheet : http://www.farnell.com/datasheets/1468533.pdf
 

donrecardo

Senior Member
Hi Buzby

I didnt realise they made them with BCD and their compliments, but no . mine are BCD only
with 5 conections 1, 2, 4, 8 and common
so I will stick with pulling all inputs low with 10K resistors and make the BCD switches have a common 0v

Don
 

hippy

Ex-Staff (retired)
They are dividing by 2 rather than 10
That's perhaps because it's a four digit divider but they are only using three digits of thumb switches.

The value set on the thumb switches isn't necessarily the actual division which will be used. In some cases the user doesn't need to know about that, just needs to know what to set to get the desired result; "001" to "999" may give a divide by 1001 to 1999, or 0010 to 9990, or 0001 to 1999 in steps of 2.

An operational description of what the circuit does and what functionality it has will probably explain why it is how it is. Trying to figure that out just from the circuit will be harder.

They are pulling all jam inputs high and using the thumb wheel switches to set the inputs low which I cant see how that can work
These will probably be active low switches, short the contacts to common which is at 0V so "0" will be closed-closed-closed-closed, which reads as low-low-low-low, %0000, zero. When "8" is selected it will be open-closed-closed-closed, so the pull-up makes it high-low-low-low, %1000, which is binary 8.
 

rq3

Senior Member
That's perhaps because it's a four digit divider but they are only using three digits of thumb switches.

The value set on the thumb switches isn't necessarily the actual division which will be used. In some cases the user doesn't need to know about that, just needs to know what to set to get the desired result; "001" to "999" may give a divide by 1001 to 1999, or 0010 to 9990, or 0001 to 1999 in steps of 2.

An operational description of what the circuit does and what functionality it has will probably explain why it is how it is. Trying to figure that out just from the circuit will be harder.



These will probably be active low switches, short the contacts to common which is at 0V so "0" will be closed-closed-closed-closed, which reads as low-low-low-low, %0000, zero. When "8" is selected it will be open-closed-closed-closed, so the pull-up makes it high-low-low-low, %1000, which is binary 8.
Hippy, I think you're right, and that is also why I suggested that a mode 10 input would be, from the human perspective, the easiest to deal with. If Don pulls all of the inputs low, and then connects his BCD switch common to +5V, he will hopefully be alright. I've seen thumbwheel switches with all kinds of weird coding. Just have to try it and see, as you said!
 

rq3

Senior Member
Just a bit more confusion
I received today a copy of the original circuit that was published in Model Engineering Workshop issue 108

They seem to be doing it all arse about face compared to what we were thinking
They are dividing by 2 rather than 10
They are pulling all jam inputs high and using the thumb wheel switches to set the inputs low which I cant see how that can work
Surely as the inputs are active high then if the switches are common negative to set the number one in BCD you would have to
turn on bits for 2 4 and 8 leaving just '1' as high, and I dont see how you would do that with a thumb wheel switch

When I get some time I will make my test bed with the chip and a clock source and see what happens when I try both methods

Here is the original circuit

View attachment 20584

Don
It will work either way. It just depends on the switches you are using. All that the chip cares about is that the appropriate pin goes HI for a valid input. Whether the zero state is because the switch pulls all 4 binary inputs DOWN from a normally HI pull-up, or the zero state is because all pins are NORMALLY pulled down and then pulled UP bit by bit is dependent upon the design of the switch.
 
Top