This code is the equivalent of the first code that i initially posted here for help.
This code was written/borrowed/loosely based on the examples found in mikroC documentation.Since this is a mikroC code i believe-as someone here said too,doesn't require fuses or some sort of configuration(endif,if defined etc) as in the initial code.This code works fine without any error and the only problem is that i am not able to space both the pulses from PWM1 and PWM2 apart from each other by a fixed time.Hope this clears everything so far
Rich (BB code):
void main()
{
PORTD=0; //Configure PORT D as output
TRISD=0;
PWM1_Init(50000); //Set freq=50Khz
PWM2_Init(50000);
PWM1_Set_Duty(127); //Set duty cycle=50%
PWM2_Set_Duty(127);
PWM1_Start(); // start PWM1
Delay_ms(200); //aprart each other by 200 milliseconds
PWM2_Start();
}