Maker Pro
Maker Pro

Trouble with ANSEL and Interrupts on PIC 16F690

Hi, I am new to MCU programming and working with a 16F690 on a
PICKIT2. I am working on a display consisting of about 60 LED's
driven by several 8-bit shift and store registers. The basic idea is
to trigger various patterns that change at a momentary button press
and operate at different loop speeds based on the value of a

All was going great until I started trying to setup an Interrupt
triggered by the momentary button. First off I am coding in C
becuase I work much faster than in asm; however, I have been hard
pressed to find external interrupt code in C to use as examples.
Most of what I've found is either in assembly or all about the
internal timer based interuppts. I have searched the web, I have a
couple of Predko books and looked through books in my local book store
without any luck so any resources that people can provide will be
greatly appreciated. That being said and my noob status established
here is the problem:

In order to get the interrupt event to work I have to set the ANSEL
register. I set this to 0 as I am only interested in triggering the
interrupt. All ports other than RA2 for the button interrupt are
outputs and no analog stuff is necessary at this time. With the ANSEL
register set to zero my interrupt works perfectly and cycles through
each display pattern as intended, but suddenly there is all kinds of
noise on the LED's. Each LED now flickers a small amount at all times
during the various pattern routines. Additionally, the patterns
themselves are slightly corrupted with some bits shifting incorrectly.
This corruption is consistent and not random. I have tried messing
around with a variety of different registers with no joy. If I
comment out the ANSEL entry this problem goes away. Can someone
please provide some suggestions, a bit more explanation on the ANSEL
register and most importantly some good C based resources for
externally driven interrupts? Thanks, Dan