Hello Glen, This is mostly taken care of automatically (even if You want it or not) by the read/modify/write function of I/O pins of all PIC processors. That is, when you modify a pin in a port by clearing or seting a bit, the whole port byte is first read, the bit is updated and the whole byte is written back to the port. When the port value is first read it is the logical level on the pin that is read and not the output latch in the PIC. If You have unused output pins in a port and want them to follow what ever they are externaly forced to just make sure You update another bit in the port often enough without explicitly seting the unused output bit. If no bit in port is modified often enough this can be done by MOV PORT_X,f which reads the portvalue and writes it back again. Any forced output pins will then change state. Be ware, though, that this may have unwanted effects on used IO pins which shouldn't be allowed to change it's state. To overcome this, use a shadow register in ram for the port and whenever the portvalue is to be updated, modify it first in the shadow register, read the portvalue, mask off the used pins, OR the result with the shadow register (which should have the unused bits set to 0) and write it back to the port. This way only the unused pins will change their state to whatever they are forced to externaly. Good luck > ruben , > where you said > "What I also do, and > have not seen mentioned here before, is to frequently read the value of the > outport and write it back. This way the pin won't be destroyed if it is > forced low when written high (short circuit to ground or something), instead > the pin state is switched to whatever it is forced to externaly." > > thats a good idea. > how do you do it .for 16f84 & 12c508 > glen > ******* ============================== Ruben Jvnsson AB Liros Elektronik Box 9124, 200 39 Malmv, Sweden TEL INT +4640142078 FAX INT +4640947388 ruben@2.sbbs.se ==============================