To get a 4Mhz clock, I think you're going to have to use an external divider to divide down the 16 MHz system clock. If the 40 kHz and 4 Mhz clocks have to be synchronized, you might consider doing it all with a counter. If the 40 kHz clock may be free running, you can use a 555 timer circuit to generate that without creating any load on the Arduino.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16