I'm a software engineer playing with PICs and have an old PS/2 mouse that I am using (successfully), which has CLK and DATA connections as open collectors.
So I have configured the internal pullups on the relevant PIC pins and am setting TRIS to 1 to let the lines go high and setting TRIS to 0 and writing 0 to the relevant PORT bit to force it low.
However, I've seen several similar PIC-to-PS/2 mouse implementations that, when writing to the mouse, set TRIS to 0 and write 1 to the PORT bit instead of setting TRIS to 1.
As I understand it, either of these will result in the line going high (is that correct?), but I'm not clear if one is somehow "better/safer" than the other.
Should I just follow the examples of the (presumably) more experienced implementations and write 1's to the PORT when the PIC is in control of the bus, or should I always make the line high by tri-stating to high impedance and letting the pullup do it?
I hope that makes sense and I haven't mixed any terminology - any general advice about best practices for open collector connections would be welcome.