I'm trying to set up comparator interrupts on an 18f2620, but I can't even get it to work without interrupts. As soon as the comparator is enabled via the CMCON register, the program seems to off into la-la land. Here is a streamlined code snippet that illustrates the setup:

************************************************** *****************
define LOADER_USED 1
define OSC 8
disable
on interrupt goto Process_Interrupts

'Configure the LCD display
output PORTB
'Set LCD Data Port
Define LCD_DREG PORTB
'Set starting data bit (0 or 4) if 4-bit bus
Define LCD_DBIT 1
'Set LCD register select port
define LCD_RSREG PORTA
'Set LCD register select bit
define LCD_RSBIT 0
'Set LCD enable port
define LCD_EREG PORTA
'Set LCD enable bit
define LCD_EBIT 1
'Set LCD bus size (4 or 8 bits)
define LCD_BITS 4
'Set LCD number of lines
define LCD_Lines 2
'Set LCD command delay time (us)
define LCD_COMMANDUS 2000
'Set LCD data delay time (us)
define LCD_DATUS 50

output porta.4
output portb.5
temp var word
adcon1 = 0

ADCON1 = $FF 'No A/D converter
'Configure the comparators
CMCON.0 = 0
CMCON.1 = 0 '4 inputs, mux'd to 2 comparators
CMCON.2 = 0

lcdout $FE,$1,$2
Pause 500

LCDOUT $FE,$80, "Inited"
LCDOUT
pause 1000

pie1 = 0
pir1=0
enable
'************************************************* *****************************
MainLoop:
lcdout $FE,$80, "Main Loop"
Pause 1000
goto MainLoop
'************************************************* *****************************
Process_Interrupts:
Disable
LCDOUT $FE,$C0,"Interrupt"
Pause 1000
Resume
Enable


end
************************************************** *****************

LCD output is produced at 3 critical points to trace where the program has gotten to:
1) Completion of comparator initialization
2) Main Loop
3) Any interrupt

So long as the CMCON register is in the default state, the program gets past initialization and into the main loop, with no evidence of any interrupts. However if CMCON is set to any operational mode, the program never even makes it to the initialization printout. Again, no interrupt message, just a blank display.

It appears that, when CMCON is configured, the program either crashes or is off doing something that I can't fathom. I bent out all the PIC pins related to the comparator, so I don't think it's a surrounding circuit issue.

Ideas?

Joe