> > ; Set prescaler to devide clock by 256 > > MOVLW 0x07 > > MOVWF OPTION_REG > > > Same here. I'm pretty sure the option register controls more than > > just a prescaler. > Well, that's all I needed it to do. Are you implying that I must change > the way I comment it ? What you need it to do and what it actually does can be be two different things. Writing 0 to a bit doesn't necessarily disable the function that bit controls (eg RAPU is active low). If you had been using RA2 as the input then INTEDG would have been important too. The button would activate code with the push on or the release according to how INTEDG is set One other reason to account for all bits is that maybe some time in the future unforeseen or improbable circumstances may happen that causes code to behave very strangely (or even dangerously). For example, leaving a RETURN address on the stack. It may seem harmless now, but it's lurking there forever, just waiting to be set free You have to be clear in your mind and your code what you want to happen and document it, for clarity now and later. If you ever re-visit code that isn't commented properly, working out what you did and why just makes more work. It's better to comment it now, while it's fresh, even if you think, well, duh, I'll remember that > > BSF INTCON, GIE ;Set the General Interrupt Enable bit to 1. > > BCF INTCON, RAIF ;Clear the PORTA interrupt flag. > > > > This is out of order. Turning on GIE is the last thing you should do in > > the interrupt setup > I thought that GIE had to be turned on in order to enable interrupts > in general. If that is not the case, then the datasheet doesn't make > too much sense to me. "PIC in Practice" also enables the GIE in > their example, although they do not state anything about IOCA > /Me is confused. If RAIF is already set and you turn GIE on, code will immediately jump to the ISR - that's why you have to make sure any unwanted pending interrupt sources are clear before setting GIE. If you want to have a good clear-out before turning on GIE CLRF INTCON CLRF PIR1 BANKSEL PIE1 CLRF PIE1 BANKSEL INTCON BSF INTCON,GIE -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist