Thanks again for the input.
I found an example bit of code on the net
Code:
ASM
__CONFIG _CONFIG1H, _OSC_HSPLL_1H
__CONFIG _CONFIG2L, _PWRT_ON_2L
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
ENDASM
DEFINE OSC 48 ; config settings 18F4520, 20mhz crystal
ADCON1 = $0F
clear
duty VAR WORD ' Duty cycle value (CCPR1L:CCP1CON<5:4>)
TRISC.2 = 0 ' Set PORTC.2 (CCP1) to output
CCP1CON = %00001100 ' Set CCP1 to PWM
T2CON = %00000101 ' Turn on Timer2, Prescale=4
PR2 = 249
duty = 200
mainloop:
CCP1CON.4 = duty.0
CCP1CON.5 = duty.1
CCPR1L = DUTY >> 2
duty = duty + 10
Pause 17
IF (duty < 800) Then mainloop
duty = 200
GoTo mainloop
The LED on CCP1CON (pin C.2) still flashes at the same rate as my original code whilst it runs through the loop to fade the LED 
So it must be hardware related. I have a port splitter to allow two connections to the header pins on the EasyPIC5 board, with the RTC module attached to one set of pins on the splitter, and the breadboard connector to the other. As this example code didn't need the RTC I removed that and plugged the breadboard directly to the header pins on the EasyPIC5 board - No more pulsing of the LED, it ramped up over and over again...
So this issue is either hardware related, or the fact the RTC is connected to same port is interfering with the CCP1CON settings...
I therefore breadboarded the RTC chip and connected the breadboard direct to PORTC - It works.... so that's one addon board that will be confined to the bin !! I can't believe that it was a simple bit of hardware that could cause the issue...
Feel like a prat now... thanks Henrik for your assistance - I can now get on with the rest of the project !
Bookmarks