Hello Kelvin,
The ATD initialisation seems OK.
Note that the CCF flag will be cleared with any read of the data registers - the problem may be with debug mode only, because you may be monitoring (reading) the data registers, so effectively clearing the CCF before you can observe it being set. Do you actually reach the ISR code?
I agree with Rocco about your inappropriate ISR content. With continuous conversion mode, and the 500kHz ATD clock, the total execution time for the ISR must be very considerably less than 224 bus cycles (56us). Whether or not it is appropriate to operate with continuous conversions with depend on the the degree of processing of the data that you require.
I think there is also a typo error in one of the lines following the read of the data registers. However, this processing seems to be a round about way of not achieving very much. You appear to require that the "digit" variable (that I assume is global) contain the current reading, but I am not sure why you need a 32 bit value. You could more simply and quickly directly load each reading byte to the variable, rather than do the calculations. I would tend to use a union between a two-byte array and an unsigned integer.
union DATA
{
UINT8 Buffer[2];
UINT16 digit;
} ATDdata;
interrupt void ATDconvert(void)
{
ATDdata.Buffer[0] = ATD1RH;
ATDdata.Buffer[1] = ATD1RL;
...
}
ATDdata.digit should then give a left justified, 16-bit value with the current settings.
Regards,
Mac