But, when I use delayMicroseconds(tdel); instead of delay(tdel); unfortunately I can't generate 20Khz to 90Khz. Would you help me please? This method is wrong? If yes, would you tell me how can generate frequency between 20Khz to 90 Khz with Arduino UNO? Thanks.
Can you explain why you think you need an interrupt?
You have a lot of float calculations. Those are slow...
Why not use integers?
You should not use delay. Delay will be added to your code execution time. You need to use a millis or micros timer. I timer will allow you to execute code, wait for the exact right moment and go on...
By the way, 100 kHz is 10 micro seconds... 5 high, 5 low. Micros() goes in steps of 4 microseconds...
So hardware timers may be your only option... (see post #2)
Continuous port manipulation requires continuation execution of codes which requires time and thus introduces inaccuracies in the output waveforms; whereas, timer-based PWM signals are not dependent on code execution except the initialization codes in the setup() function.