If I tell you that the period of a waveform is the reciprocal of the frequency, would that be helpful to you. In this case:how does one generate a 40khz pulse on the two pins of a 12mhz 8051 microcontroller in code. im using c but asm is welcome. even when using time delays, i wouldn't know how long a delay have to be to generate a desired frequency.
1 / f (the frequency) = T(the period)
1 / 40,000 = 25 x 10^-6 or 25 microseconds