It must be something to do with the internals of the PCA chip as the modified code that includes Tumbleweed's suggestion has the same effect, even though the PIC code isn't running the subroutine (I have a led that is lit whilst the sub routine is being accessed and that pulses once when the lights come on, and once again when the lights go off)
Would there be anything to gain if the code in the SetPCA: section above is placed in the check section like this
Code:If Counter1 => CH1_on_Time and counter1 < CH1_off_time then ' check to see if the time in minutes since midnight matches the Channel on time CH1_PWM = fadeset1 ' and of so set the PWM value (0 to 4095) to match the fadeset value (also 0 - 4095) endif If Counter1 => CH1_off_Time or Counter1 < CH1_on_time then ' check to see if the time in minutes since midnight matches the channel off time CH1_PWM =0 ' and if it does, then set the PWM value to 0, this turning the channel off endif ... ' check to see if CH1_PWM is different from last programmed value if (CH1_PWM <> PCA_PWM) then PCA_PWM = CH1_PWM pcaChannel = 0 i2cControl = $6 + 4*pcaChannel I2CWRITE SDApin,SCLpin,i2cWriteAddress,i2cControl,[0,0,PCA_PWM.lowbyte,PCA_PWM.highbyte] endif






Bookmarks