Hello,
I rather like Rocco's approach that would not require any interrupts.
Both toggle on overflow and toggle on compare are available for both channels, however it would appear than toggle on overflow would not work unless output compare mode is selected. So, toggle on compare for the 1kHz channel should give the desired result.
Perhaps the following setup would work, assuming trimmed 3.2MHz bus clock frequency, and with channel 0 used for the 2kHz output, and channel 1 for the 1kHz output.
TSC = 0x30; // Stop and clear TIM counter, prescale 1
TMOD = 1599; // Overflow period 500us
TCH0 = 800; // 50% duty for Ch 0
TSC0 = 0x1A; // Unbuffered PWM with clear O/P on compare
TCH1 = 800; // Toggle point for Ch 1 output
TSC1 = 0x14; // Output compare with toggle on compare
TSC_TSTOP = 0; // Enable TIM counter
With this setting, the 1kHz signal should toggle on each negative edge of the 2kHz signal.
Regards,
Mac