Home › Forums › Microcontrollers › PIC Microcontroller › PWM using PIC18F › Reply To: PWM using PIC18F
March 22, 2015 at 7:51 pm
#11106
Keymaster
You can program like this :
.............
.............
TRISD.F0 = 1;
TRISD.F1 = 1;
.............
.............
while(1)
{
while(PORTD.F0 == 0)
{
LATB.F0 = 1; // Use LAT register to write output in 18F
Delay_ms(1000);
LATB.F0 = 0;
Delay_ms(2000);
}
while(PORTD.F1 == 0)
{
LATB.F0 = 1;
Delay_ms(2500);
LATB.F0 = 0;
Delay_ms(5000);
}
}
