Programmatically scaling CLKO

Hi, I have an external chip (AD5933 that I would like to interface with the Arduino. The AD5933 has its own 16 MHz internal oscillator, but I also need clock signals lower than that as well, specifically 4 MHz, 2 MHz, 1 MHz, 250 kHz, 100 kHz, 50 kHz, and 25 kHz. Though, I would settle for just 2 MHz . There is no way to scale the AD5933's internal oscillator. Since I am interfacing the AD5933 with the Arduino, I know I can output the Arduino's clock by changing bit 6 of "low_fuses" per this post Clock signal on a digital pin - Microcontrollers - Arduino Forum But, I was also wondering if it were possible to change the clock output within an Arduino sketch since I need to dynamically change the AD5933's clock input (which would be from the Arduino). The Arduino will be responding to serial events as well as controlling other functions of the AD5933, so that makes it impossible to use something like PWM for this. Any help would be great. Thanks.

Why not something like the DS1077?

Yeah I was looking to just use a frequency divider, but was curious if there was a way to do this in Arduino. It would save me a few IO pins which would be nice for this project. But, not critical. Thanks for the response.

Ah this uses I2C. Then it wouldn't use additional IO pins.

You could also use a timer to output a square wave on an Arduino pin. I don’t know how close to the 16 MHz you could get.

Clocking a timer at full speed you can get upto 8MHz PWM.

You'll need to set the timer control registers directly to use an appropriate mode and
set the TOP value. For 2MHz for example you need TOP = 7, and the OCR = 3, which
gives 4 clocks low, 4 clocks high output waveform.

Right, but I couldn't do anything else with the Arduino because it is outputting the PWM signal. The processor would be too interrupted.

Wrong. Once it is set and going the timer requires no CPU time except when you change it.

Awesome. That'll work then.