> Thank you David and everyone else who helped. > I found the "bug" but not real happy about what it > was... I have put the code below. Maybe you're ready for a better way of doing this. Check out my PORT module at http://www.embedinc.com/pic. It would have automatically taken care of this issues and made porting much easier. It does an IFDEF on CMCON to decide whether to disable the comparators. There is similar code for the A/D which will save from trouble next time you move to a different processor. > ---------------------------------------------- > This code DOES NOT work, sympoms are same as CMCON not > set properly: > > IFDEF __16F628 > > banksel 0 ; > movlw b'00000111' ; disable comparators > movwf CMCON ; > > clrf T1CON ; disable timer1 > clrf T2CON ; disable timer2 > clrf CCP1CON ; disable CCP module > > banksel 1 ; do bank 1 stuff > clrf VRCON ; disable Vref > clrf PIE1 ; disable pi etc > banksel 0 ; > ENDIF > > ---------------------------------------------- > This code works!!! > > IFDEF __16F628 > > banksel 0 ; > clrf T1CON ; disable timer1 > clrf T2CON ; disable timer2 > clrf CCP1CON ; disable CCP module > > banksel 1 ; do bank 1 stuff > clrf VRCON ; disable Vref > clrf PIE1 ; disable pi etc > banksel 0 ; > > movlw b'00000111' ; disable comparators > movwf CMCON ; > ENDIF > ---------------------------------------------- This doesn't make any sense. This smells like the problem is elsewhere and just appears to be related to CMCON. Are interrupts truly off at this point? If not, changing what happens before and after messing with PIE1 could change the behavior. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads