Gavin Jackson Wrote: > Hi there > > I would just like some opinions on this. Does this > solve the read-modify-write problem. > > All PIC pins have external pull-ups. When the program > starts the instruction CLRF PORTX is issued to write a > logic '0' to the data latch. If you want a logic '1' on the > port you simply make it an input, by writing a '1' in the > TRISX register corresponding to the bit position. > If you want a logic '0' you make the port pin an output and as > the data latch already contains a '0' you know that the pin > will pull the external pull-up to ground. > > You no longer read and modify the PORT, but rather the > TRIS register for that port. > > Any thoughts on this method? > > Regards > > Gavin Sounds good to me. This is exactly the method I used to implement an IIC bus on a 16C74 at www3.mistral.co.uk/brian.clewer/ . The macro's SDAUP SCLUP etc are in the general.equ file. Regards, Brian.