455
/** * File: main.c * Author: Marwen Maghrebi * Description: This project demonstrates how to control the brightness and color of an RGB LED using PWM * (Pulse Width Modulation) on the PIC16F877A microcontroller. The microcontroller is set up to produce PWM signals * that control the RGB LED's colors through different duty cycles, creating a smooth fading effect. */ // Configuration bits for PIC16F877A #pragma config FOSC = XT // XT Oscillator #pragma config WDTE = OFF // Watchdog Timer Disable #pragma config PWRTE = OFF // Power-up Timer Disable #pragma config BOREN = ON // Brown-out Reset Enable #pragma config LVP = OFF // Low-Voltage Programming Disable #pragma config CPD = OFF // Data EEPROM Code Protection Disable #pragma config WRT = OFF // Flash Write Protection Disable #pragma config CP = OFF // Flash Code Protection Disable #include <xc.h> #include <stdint.h> #define _XTAL_FREQ 4000000 // Define the operating frequency of the microcontroller