yes ... I am selecting the correct functions. However it seems to be suffering for noise or something and acts irradically How do I prevent this noise/random behaviour ? On Fri, Apr 30, 2010 at 7:05 PM, ivp wrote: > > Also do I need to put resistors or something between the input pin > > and the switch to prevent interference ? > > Not sure what you mean by interference. For a simple "switch is > closed, LED is on" test, a pull-down resistor on the pin would be > enough. Noise from the switch operation, "contact bounce", can be > handled in software, with the optional assistance of a resistor-capacitor > filter > > > since I cant seem to get any clear input readings ... > > What are you reading ? With the components described above, you > should measure 0V on the pin when the switch is open, Vcc when it's > closed > > > for some reason when I program it to light up the leds when the > > switch is hit they are always lit > > Are you selecting the correct banks to set the pin functions ? > > For example > > banksel trisa > movlw b'00001000' ;all output except /mclr > movwf trisa > > banksel porta > clrf porta ;all outputs low > > banksel ansel > clrf ansel ;all pins digital > > etc > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- Jason White - Python and C++ Programmer -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist