Steve wrote >Well the software shouldn't be all that complicated. To get a precise >50us output, you can code a software loop which runs while interrupts >are disabled (e.g. in the interrupt handler itself). Of course this >depends on whether the rest of your application can tolerate this. If >you are using slave IIC at 100KHz, 50us should not cause you to lose >any data, since a byte will take about 80us to receive. I agree, but the frequency is selected by the I2C received data and with a fixed pulse width I will have to do some extra calculations in order to convert the recieved(wanted freq) in to the High and Low Timer value and I gues you know that performing calculations isn't mplabc's strongest side. >Compare mode allows timer1 to free-run as a divide-by-anything counter, >so long as you set the flag which resets timer1 to zero when the compare >'hits'. If you set it up correctly, timer1 starts at zero and counts >up at a rate set by the processor clock and a prescaler. When it reaches >the 16-bit value in ccpr1h/l, timer1 is automatically reset to zero and >and interrupt will be triggered. Does the value in CCPR1H/L need to be reloaded? I also need to switch the pulse generation on and off via I2C, what do you suggest is the most elegant way to this. 1.Stop TIMER1. 2.Disable the CCP1 interrupt. 3.Switch off capture mode (CCP1CON = 0x00) 4.Let everthing as it is but stop switching the PORT. Regards, Frank Temmerman Belgium