Generating Square Wave with with modulated carrier frequency

Dear Sir

OK as you say you require waveform ,please find here attached waveform that I think will work for me.I have tried it with Timer 1 But without success.
Please give some idea or sample sketch for the same.
Thanks

This should have been the first thing you gave us.

Dear sir This thing we have decide yesterday.But do not know how one can achive the same. Thanks

You could gate an external oscillator using two PWM outputs. Both at 50% when A0 is at 0%. Then as A0 increases, one reduces PWM, the other increases PWM. An external XOR logic is used to gate an external 5MHz clock.

But - what kind of resolution do you need and how accurate must that 18kHz be? You can set a higher PWM frequency from the Arduino, but it isn't infinitely variable, and the resolution (bit depth) is reduced at higher frequencies.

I come from a hardware background. So I picture doing this with a crystal oscillator divided down to 5MHz and 18kHz, using a ramp to generate the PWM signals, XOR to gate the 5MHz signal, and use the Arduino to control the ramp/PWM generator.

I'm sure someone here can help with doing nearly all (or all) in software. Perhaps with something faster like a Due or Teensy 3.1.

Thanks for reply I wish to do all these things in software preferably arduno uno Thanks

Thanks for reply I wish to do all these things in software preferably arduno uno Thanks

And....

But - what kind of resolution do you need and how accurate must that 18kHz be?