Ok, I got a Bi-color LED working with the 16F818. The program is two files, the c source file and the header file which contains the defines and fuses. The CCS compiler project wizard made the two files. You'll have to open the header file in order to modify it. Use the 'OPEN Any File' option. Also note that the '#USE FAST_IO' was not used. You should be able to modify the program to use with your RGB LED. Take the setup_oscillator line out as I use the internal oscillator with the 16F818. You'll also have to modify the delay define for the 20 Mhz.
The C source file: Flash_LED_818.c
C:
#include <Flash_LED_818.h>
void main()
{
setup_oscillator( OSC_8MHZ );
setup_adc_ports(NO_ANALOGS);
//Example blinking LED program
while(true){
output_high(LED_RED); // Turn on RED LED
delay_ms(DELAY);
output_low(LED_RED);
output_high(LED_YELLOW); // Turn on YELLOW LED
delay_ms(DELAY);
output_high(LED_RED); // Turn on both to produce ORANGE
delay_ms(DELAY);
output_low(LED_RED); // Turn off both LEDs
output_low(LED_YELLOW);
delay_ms(DELAY);
}
}
The header file: Flash_LED_818.h
C:
#include <16F818.h>
#device adc=16
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES WRT //Program Memory Write Protected
#use delay(int=8000000)
#define LED_RED PIN_B0
#define LED_YELLOW PIN_B1
#define DELAY 1000