Hi Alain

Thankyou Alain for taking the trouble to read my post and make a suggestion, may I draw your attention to the defines further down Darrel's wonderful coding.

;_____ Comparators __________________________________________________ ________
#define CMP0_INT PIR1, CMP0IF ;-- Comparator 0 - 1230/1330 only

CMPIFREG = PIR2 ;-- Comparator 1
CMPIEREG = PIE2
CMPIPREG = IPR2
ifdef C1IF ; 18F24K20 18F25K20 18F26K20
CM1IFBIT = C1IF ; 18F44K20 18F45K20 18F46K20
endif
ifdef CM1IF
CM1IFBIT = CM1IF ; several J PICs
endif
ifdef CMP1IF
CMPIFREG = PIR1 ; 1230/1330 only
CM1IFBIT = CMP1IF
CMPIEREG = PIE1
CMPIPREG = IPR1
endif

ifdef CM1IFBIT
#define CMP1_INT CMPIFREG, CM1IFBIT
endif

ifdef C2IF ;-- Comparator 2
CM2IFBIT = C2IF ; 18F24K20 18F25K20 18F26K20
endif ; 18F44K20 18F45K20 18F46K20
ifdef CM2IF
CM2IFBIT = CM2IF ; several J PICs
endif
ifdef CMP2IF
CM2IFBIT = CMP2IF ; 1230/1330 only
endif

ifdef CM2IFBIT
#define CMP2_INT CMPIFREG, CM2IFBIT
endif
'-----------------------------------------------------------------------------

I think we are all waiting for the "K" series, perhaps this will compile to the K. I shall try it.

I did wonder wether I should set the ADCON for this device particularily the LATA register. But I am also aware that <6> of the PIR2 PIE2 and IPR2 only refers to one CMI, I presume I shall have to be careful to make sure that any interrupt on either comparator does not interfere with the other. ie if one comparator is set then the other is disabled.

Thanks again for your help.

Duncan