Tom=E1s =D3 h=C9ilidhe escribi=F3: > My board is going crazy when I turn it on, and I reckon it's to do with > there being a wrong interrupt setting or a pin set as a comparator when > it shouldn't be. > = > Can someone please help me with the startup code for my 887? Here's how > it should work: > = > * All pins should be set as I/O > * All interrupts should be disabled > * Port B should have internal pull-up's enabled > = > Here's what I've got so far: > = > void StartupConfig(void) > { > ANSEL =3D 0; /* Turn off Analog-to-Digital */ > = > OPTION &=3D ~0b10000000u; /* Turn on pull-up's for Port B */ > WPUB =3D 0b111111; /* Individually set pull-up's for Port B */ > } > = > How do I turn off comparators? When I used the PIC16F684, it was done by > "CMCON0 =3D 7", but I don't know how to do it for the 887. > = > Is there anything wrong with my code for setting the pull-up's, because > it doesn't seem to be working? > = Tom=E1s, check the following 1. Check also for the ANSELH register, this also acts on = PORTB on this pics. 2. Take a look at the VRCON , CM1CON0 and CM2CON0 regs in = order to configure and or disable the Analog Comparators and = Voltage Reference. -- = ------------------------------ Mauricio Giovagnini (Maunix) www.maunix.com.ar Cordoba, Arg. LinkedIn Profile: http://www.linkedin.com/in/mgiovagnini -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist