#define _XTAL_FREQ 20000000.
void main()
{
TRISC = 0x00; // PORTC as output.
PWM1_Init(5000); // Initialize PWM1.
PWM1_Start(); // Start PWM1.
UART1_Init(9600); // Initialize UART with baud rate 9600 bps.
while (1) // Endless loop.
{
Delay_ms(400);
UART1_Write(64);
// Okunan PWM değerlerini USB to TTL adaptörü üzerinden bilgisayara gönder.
PWM1_Set_Duty(63);
Delay_ms(400); // Bekleme süresi.
PWM1_Set_Duty(127);
Delay_ms(400);
UART1_Write(127);
Delay_ms(400);
PWM1_Set_Duty(190);
Delay_ms(400);
UART1_Write(190);
Delay_ms(400);
PWM1_Set_Duty(255);
Delay_ms(400);
UART1_Write(255);
Delay_ms(400);
}
}