Argh this is from memory but here goes: I believe there is an issue if you write to a port and rapidly (next cycle) read that port. Especially if there is a capacitive load on one of the output pins. When you read the port the second instruction, the PIC reads the state of the port in hardware, the capacitively loaded pin is still changing state, then the pic WRITES what it reads to the port. Thus you can tell a pin to go to zero, immediately read it, it is read as zero, then come back later and it is 1 and you say "What the F()&%#$&*&#$???" . I believe this also comes into play if you BSF a port pin - the PIC reads the entire port in hardware, and if a different port pin is in transistion at that time some pins can end up in unexpected states, also generating a "WTF???" from the programmer. Someone else will chime in and correct some minor detail in what I just said, I am sure. The thing I remember most is "Dont read or write ports without a buffer byte". Look in a PIC datasheet under "read-write-Modify" and get more detail. The datasheet does not admit this is a bug. Generally if I write to a port, I change a bit in my buffer, (A.K.A. mirror), byte and then write the entire byte to the port at once. Same for reading a port. -- Lawrence Lile Lindy Mayfield Sent by: pic microcontroller discussion list 06/18/2004 01:11 PM Please respond to pic microcontroller discussion list To: PICLIST@MITVMA.MIT.EDU cc: Subject: Re: [PIC]: anding/masking What is the read-write-mod bug you speak of? > Direct reading of ports invites the Read-Write-Modify bug, as --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.699 / Virus Database: 456 - Release Date: 6/4/2004 -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body