How to generate the 18kHz sqaure wave using 8051
even easier: use the PCA of course, if you insist on using some antique or 'simple' chip, that does not apply
Erik
reference: The PCA cookbook www.intel.com/.../270609.htm