Jan-Erik, This movlw b'10100000' ; Enable timer interrupts ; 1------- Set GIE ; -0------ Clear PEIE ; --1----- Set T0IE ; ---0---- Clear INTE ; ----0--- Clear GPIE ; -----0-- Clear T0IF ; ------0- Clear INTF ; -------0 Clear GPIF was actually nice. I usually comes up with something like (or have since 1979) movlw 0xc0 ; Set GIE ; Clear PEIE ; Set T0IE ; Clear INTE ; Clear GPIE ; Clear T0IF ; Clear INTF ; Clear GPIF .... Mostly using a constant of course but the issue is the same. And this is always hard when you change something. Probably will change this from now on. Thanks! /Ake -----Ursprungligt meddelande----- Fr=E5n: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]F=F6r Jan-Erik Soderholm Skickat: den 23 april 2004 10:32 Till: PICLIST@MITVMA.MIT.EDU =C4mne: Re: [Pic:] 12F675 strange behaviour > I've been wondering how to best go about setting multiple flags when > setting up INTCON for example. So, to begin with I was doing: > > movlw b'10100000' ; Enable timer interrupts > movwf INTCON > > I presume that the recommendation is to set the flags individually, > even though it might cost an instruction or two, for the sake of > being easier to read: > > clrf INTCON > bsf INTCON,T0IE > bsf INTCON,GIE Hi. Many (incl me) find the following way of coding to be easy to read and self-documentary : (It should line up using a fixed pitch font...) movlw b'10100000' ; Enable timer interrupts ; 1------- Set GIE ; -0------ Clear PEIE ; --1----- Set T0IE ; ---0---- Clear INTE ; ----0--- Clear GPIE ; -----0-- Clear T0IF ; ------0- Clear INTF ; -------0 Clear GPIF movwf INTCON It's easy to read, and uses fewer instructions then multiple bcf/bsf. Regards, Jan-Erik -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.