put eather a software delay or a hardware delay by using a timing capacitor in parallel and a pullup resistor when querying for input on the interrupt 1 millisecond is good enough delay.. If you go with the hardware solution you will need a an input pin assigned to the button that is schmitdt triggered as the rising time for the button pulse is greatly reduced.. the button may be springing... and producing unwanred pulses... "Dan Price" wrote in message news:4800c2c60609132308t6ff5ff2ua1715e893804272d@mail.gmail.com... > 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 > potentiometer. > > 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 > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist