How do I get a 1Hz signal?

Status
Not open for further replies.

Lac

New Member
Im wondering how I'm able to set the devide number on the 4790 Decade Counter chip to devide by the numbers between 0 and 9. I have got a 32KHz output and need to devide it down to 1Hz (32000Hz /10/10/10/8/4 = 1Hz ) I know how to devide by 10, but don't know the other two: 8 and 4.

Or is it some other way to get 1Hz output, that is easier (better?)

Thanks!
Lac.
 
Lac said:
Or is it some other way to get 1Hz output, that is easier (better?)

Make a 32768Hz crystal oscillator and just run the clk to a 15-bit binary divider. 32768Hz crystals are quite common.

Edited 32767 to 32768.
 
Download the datasheet of the CD4060 datasheet here. There is a circuit diagram on how to hook it up to a 32768Hz crystal. Unfortunately it's only a 14-bit divider so you have add a single divider after that to get 1Hz.

https://www.fairchildsemi.com/pf/CD/CD4060BC.html

If you still don't know how to do it, go buy a book on TTL and CMOS circuits.
 
If neccessary, you may use timers to make 1Hz pulse.

Timer0 has itself the prescaler upto 1/256. With 4MHz osc, you get 256 us to increment timer0 register.

1 Hz => 1 second = 1,000,000 us.

256 * 256 = 65536. And you need only about 15 times more.

Using interrupts, you can get it.

Do this loop forever:

pulse width = P ; P = 255*X
; if X > 255 then X = 255 * Y

bsf a pin
move Y to temp
as interrupts decrement Y until Y = 0
bcf the pin

compute temp = 255*255 * 15 (for example) - P
wait interrupts and decrement Y' until Y'=0
return to loop

You can get 1Hz pulse.

In this case, the resolution is 256us.
If you need better resolution you can use prescaler at 1/16. It's oki, because 16*256*256 > 1000000 us.

Goodluck.
 
Well well well, my Eng is so bad

Code:
Interrupt Service Routine here:

dcfsz temp
goto end_of_ISR

move new value to temp
move new value to tmr0
if pin is ON
bcf the pin you want. (or bcf)
else
bsf the pin

end_of_ISR
retfie
That is what you should do.
 
hmm.. but ain't I able set the devide number at the Decade Counter chip to devide by 4 and 8 at all?

Thanks!
Lac.
 

I am assuming you meant 7490 instead of 4790!

If you simply wish to divide by 4 or 8, and not count to 4 or 8, then:

To divide by 4, feed your input to CLKB, and pick up the output from QC.

To divide by 8, feed your input to CLKA. Connect QA to CLKB, and then pick up the output from QC.

Note that the divided clock waveform will not be symmetrical (50% duty cycle). However, if you are using something like a digital clock where you will be counting the pulses, the symmetry would not matter.

Jem
 
ops. my bad. meant the 7490. Thanks, that was exactly what I wanted to know. But how did you know? Where is the diagram? the truthtable?

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