On Fri, 2006-03-10 at 17:57 -0800, William Chops Westfield wrote: > On Mar 10, 2006, at 11:51 AM, pic wrote: > > > My C program for flashing leds is not working. > > /* Light the LEDs */ > > LATD += 1; > > > > Both of your programs use this to 'toggle' the LEDs, but > I'm not sure it's a good idea due to the usual > problems with Read/Modify/write on PICs. Just because you > wrote a 1 or 0 to a port pin doesn't mean that's what will > be read back when you read the port... Actually, that's the point of the LAT registers. The LAT registers map directly to the latches that control the outputs. A read of these registers reads the state of the actual latches for the outputs, there is no influence from the outside world. While a read-modify-write operation does occur, it will always read correctly no matter what the port pins are at. TTYL ----------------------------- Herbert's PIC Stuff: http://repatch.dyndns.org:8383/pic_stuff/ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist