Author Topic: Generating selectble clock speeds?  (Read 664 times)

0 Members and 1 Guest are viewing this topic.

Offline gmcTopic starter

  • Regular Contributor
  • *
  • Posts: 116
  • Country: gb
Generating selectble clock speeds?
« on: October 26, 2021, 08:56:37 am »
I"m busy with a project where I would like to have a selectable clock speed of 1, 2, 4, 8MHz which is selected by a  4 way DIP switch.

This will be used to drive a CPU which can then be tested as different  speeds.

Any suggestion on what would be the easiest approach. I was thinking of LM555 but then it has a max frequency on 2MHz and am not sure how I would even switch between the freq.

I could go overboard and use a arduino but there must be a easier and simpler approach. Maybe some clock generator chip I'm unaware of?
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1417
  • Country: us
  • Very dangerous - may attack at any time
Re: Generating selectble clock speeds?
« Reply #1 on: October 26, 2021, 09:53:35 am »
16 MHz oscillator module and a 74HC161 or 74HC4040
 

Offline gmcTopic starter

  • Regular Contributor
  • *
  • Posts: 116
  • Country: gb
Re: Generating selectble clock speeds?
« Reply #2 on: October 26, 2021, 10:50:42 am »
Thanks, great idea. Why didn't I think of that. :)

On the ripple counter I can just connect the outputs via the dip switch
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12863
Re: Generating selectble clock speeds?
« Reply #3 on: October 26, 2021, 11:15:49 am »
That's NOT a job for a regular DIP switch as any misconfiguration can short outputs together - either use a jumper, preferably five pin cruciform with the output from the center pin, but a 2x3 block with two commons in the middle for the output would also be reasonable, or use a four way switch, possibly a SMD slide switch.

However, you seem to be going to a lot of trouble to avoid a MCU.  Any low pin count PIC or AVR with CLKOUT and a runtime selectable clock divider can do the job *WITHOUT* running the clock signal through switches.
 

Offline gmcTopic starter

  • Regular Contributor
  • *
  • Posts: 116
  • Country: gb
Re: Generating selectble clock speeds?
« Reply #4 on: October 26, 2021, 11:37:20 am »
Hmm, that's a another thing I didn't think about. If the user turns 2 or more outputs on then they will be shorted together. 
Maybe a jumper is better, but still not idiot proof. I"ll look into a low pin count MCU. Ideally this would probably be the most foolproof with a  button to scroll through the frequencies
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19528
  • Country: gb
  • 0999
Re: Generating selectble clock speeds?
« Reply #5 on: October 26, 2021, 02:36:46 pm »
Thanks, great idea. Why didn't I think of that. :)

On the ripple counter I can just connect the outputs via the dip switch
How about a multiplexer such as the 74HC4052? If you don't need two channels, put them in parallel to reduce the impedance.
 

Offline Picuino

  • Frequent Contributor
  • **
  • Posts: 730
  • Country: 00
    • Picuino web
Re: Generating selectble clock speeds?
« Reply #6 on: October 26, 2021, 03:08:54 pm »
Hmm, that's a another thing I didn't think about. If the user turns 2 or more outputs on then they will be shorted together. 
Maybe a jumper is better, but still not idiot proof. I"ll look into a low pin count MCU. Ideally this would probably be the most foolproof with a  button to scroll through the frequencies

There are tiny PICs that can do the job very well.
I use the PIC16F15323 for doing a similar circuit. This PIC has four special modules called CLC (Configurable Logic Controller) which is programmable logic. For example you can make four divisors by two of an asynchronous signal.

Edit:
Of course, the CLC is programmable in execution time by the internal program in order to select the desired output.
At last, you have a 16MHz oscillator, a divisor a multiplexer and a microcontroller to control them in one simple chip.
« Last Edit: October 26, 2021, 03:14:20 pm by Picuino »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf