Kev Howard wrote: > I am trying to generate an approximate 32khz signal on a gpio of a > 12c508/a running at int osc. OK, how close do you want? If the internal oscillator runs at 4 MHz nominal, you have a 1 MHz instruction clock. A complete cycle at 32 KHz requires 31.25 instructions, so if you approximate to 31 instructions you get a frequency of 31,250 Hz plus or minus a few percent. You simply need a loop of 30 instructions (including one branch which takes two instructions) with the bit set and bit clear instructions placed equal delays apart. Neither TMR0 nor prescaler has any part in this, the operation is too fast. They are appropriate for timings in the millisecond range. -- Cheers, Paul B.