> -----Original Message----- > From: piclist-bounces@mit.edu > [mailto:piclist-bounces@mit.edu] On Behalf Of Rikard Bosnjakovic > Sent: 18 June 2009 07:18 > To: Microcontroller discussion list - Public. > Subject: Re: [pic] How to make a led flash > > On Thu, Jun 18, 2009 at 06:41, solarwind > wrote: > > > I had the same problem before. The solution for me was to turn off > > analogs (that's whats causing the problem when you come > close to the > > PCB). > > That will only affect situations where ports are defined as > input. If GP0 is defined as an output, then it does not > matter what it says in the ANSEL-register; GP0 will work as expected. For limited values of "expected" (as Russell would say). If a pin is configured as an input then the PORT register will always return zero for that bit. Setting or clearing a port pin configured for analog use should set it correctly, but since this is a Read-Modify-Write operation any other pins configured as analog will get set to zero which probably won't be expected. Note that other R-M-W operations such as XORing the port with a mask to toggle the LED state will NOT work with the pin configured as an input. Regards Mike ======================================================================= 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. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist