CD4059, To Divide by 546

Status
Not open for further replies.

chemelec

Well-Known Member
I Need to divide a 32,768 Hz Signal from a Watch Crystal, down to 60 Hz.
So a division of 546 would be close enough.

My Age is Getting to me and My Brain just isn't working for this.
Can Anyone Help with which Pins go High and Low for this?

Much Appreciated.
 
The explanation is a little convoluted but basically you would enter (jam) the number (in BCD) of 546 into the counter and then it counts down to zero, giving an output pulse at that point.
It then reloads the number and counts down to zero again, thus giving you the divide by 546 you want.
 
Does the jam input need to be 546 or 545.
546 = 512 + 32 +2 and 545 is 512 + 32 + 1 or bits 8,5 & 1 or 8,5 & 0

Edit, if the inputs are BCD then forget the above.

Mike.
 
Search "why 32,768 Hz" and you will find many explanations of both the how[/i) and the why.

32,768 = 2^15, so repeatedly dividing by 2 gives you 1Hz exactly.
 
If I'm reading Fig 1 of the '4059 datasheet correctly, I think it goes like this :-
N=0546.
Let's choose Mode=8.
So Ka=0, Kb=0, Kc=1.
N/Mode = 0546/8 = 068 remainder 2.
So we code remainder 2 in J1,2,3 and 0 thousands in J4, giving J1 J2 J3 J4 = 0100.
The 8 (x1) gets coded in J5,6,7,8 as J5 J6 J7 J8 = 0001.
The 6 (x10) gets coded in J9,10,11,12 as J9 J10 J11 J12 = 0110.
The 0 (x100) gets coded in J13,14,15,16 as J13 J14 J15 J16 = 0000
 
Does the jam input need to be 546 or 545.
546.

Normally, 0 is a valid counting state, so you would preset 545 to get a cycle length of 546. However, the 4059 appears to manage this for you, so you enter the exact divisor you want.

ak
 
If you already have the 32768 kHz crystal on hand, and are satisfied with the output frequency not being exactly 60 Hz, that's fine, but there are other crystal frequencies available that can be divided down exactly to 60 Hz.
30000, 30720, 31200, 31500, 36000 and 38400 kHz crystals are available.
 
The 32,768 Crystal is one I already have.
However I also have some 76,800 ones and that divides out to precisely 60 Hz, by division of 1280.

Thanks BobW
 
There is a project I did which got published on Silicon Chip magazine, which describes how to exactly obtain 50 or 60 Hz and its 2nd harmonic (in the instance that you are driving a common alarm clock) derived from a watch crystal and utilizing the CD4059 assisted by a small 8 pin micro.

 
The schematic makes it look like the output of the 4059 is exactly 120/100 Hz, which we know is not correct. Based on nothing but the schematic, it looks like the 60 Hz output is off by 0.16%. As a time of day clock source, that's a steadily decreasing error of over 2 minutes 15 seconds per day. Hmmm ... are you changing between /273 and /274 at something other than a 50/50 duty cycle?

But separate from that - If you have a PIC, why do you need the 4059?

ak
 
Last edited:
Because to obtain exactly 120 Hz from 32768 Hz, one has to jam the counter for a 273 divisor for 14 periods, and then jam for a 274 divisor for 1 period.

The resulting divider ratio is (273*14 + 274*1)/15 = 273.06666666666 which is the exact ratio what you require.
The microcontroller keeps track of the cycle counts and also divides the 120 Hz to 60 Hz.
In other words, you achieve the required ratio by speeding up and slowing down the counter. There will be some jitter, but for a timekeeping purpose, it is usually of no consequence.

The microcontroller is not a raw PIC but a PICAXE, which runs under a BASIC interpreter.......it executes far slower than a raw PIC does.
 
Because to obtain exactly 120 Hz from 32768 Hz, one has to jam the counter for a 273 divisor for 14 periods, and then jam for a 274 divisor for 1 period.
Cute trick. Must have been fun working out the ratios. But still, can't the PICAXE do that internally, or are you saying it isn't fast enough to do everything necessary within one input clock cycle?

ak
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…