> -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf > Of Tom=E1s =D3 h=C9ilidhe > Sent: 22 August 2008 17:09 > To: Microcontroller discussion list - Public. > Subject: [PIC] Where's the interrupt coming from? > = > = > I've got 7 independent push buttons on my board. They are connected to > B0, B1, B2, B3, B4, B5 and D6. > = > When a push button is pressed, it provides a path to ground. > = > B0 through B5 are floating when they are not pressed; the idea here was > to use the 887's internal pull-up's, but I can't get them to work. > = > Another problem I'm having is that the microcontroller keeps resetting > if B3 is left floating, but I don't understand why because I've got all > interrupts disabled. > = > Here's my config code: > = > __CONFIG(FCMDIS & IESODIS & BORDIS & UNPROTECT & MCLRDIS & PWRTEN & > WDTDIS & INTIO); > = > And here's my start-up code: > = > void StartupConfig(void) > { > ANSEL =3D 0; /* Turn off Analog-to-Digital */ > = > INTCON =3D 0; //Disable all interrupts > CM1CON0 =3D 0; //Comparators off > CM2CON0 =3D 0; //Comparators off > = > WPUB =3D 0b00111111; /* Individually set pull-up's for Port B */ > IOCB =3D 0b00000000; /* Disable interrupts for Port B */ > = > OPTION &=3D ~0b10000000u; /* Turn on pull-up's for Port B */ > } There are two ANSEL registers for the 16F887; ANSELH is the one that deals = with PORTB pins. Weak pull-ups will be disabled if the port is configured = for analog input. Regards Mike =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist