The behavior would imply a problem with the bank select command. If it were not correctly switching to bank 1, then the clrf VRCON would be clearing the value moved into CMCON in the first example. Have you followed this code through on the simulator? It's usually a pretty good way to check this sort of problem. regards, Bob Bullock At 12:59 PM 8/30/2002 +1000, you wrote: >David Duffy wrote: > > > I've done a dozen or so F628 projects so far. CMCON bit me too! > > Regards... > > >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. > >---------------------------------------------- >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 >---------------------------------------------- > >I fiddled with it a bit, and it only seems to do the >"movwf CMCON" if it occurs AFTER the VRCON/PIE pair!!!! > >Is there a known F628 bug where CMCON has to be done >AFTER clearing VRCON or PIE1 registers?? Or is this >some freaky MPASM fault with the IFDEF directives?? > >Or am I so completely stupid that I have no idea what >i've done wrong?? :o) >-Roman > >-- >http://www.piclist.com hint: To leave the PICList >mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu