On 8/7/2012 1:29 PM, Harold Hallikainen wrote: > Following up on what someone else mentioned, a pin can be used as an open > drain output by driving the TRIS register instead of the PORT or LAT > register. You set the PORT or LAT bit low. When TRIS is low, the pin is > pulled low. When TRIS is high, the pin floats. If the pin has a 5V > tolerant input, it can be pulled up to 5V, making this a 5V output. > > But, I think I recall the original problem being a UART interface. Since > you can't make the UART drive the TRIS bits, that would not work here. In > that case, I still think the 74HCTxxx is a good solution. > > Harold > That's a good idea and Microchip has implemented it on some of the newer=20 parts. The PIC18F27J13 datasheet says: 20.3.3 OPEN-DRAIN OUTPUT OPTION The drivers for the SDOx output and SCKx clock pins can be optionally configured as open-drain outputs. This feature allows the voltage level on the pin to be pulled to a higher level through an external pull-up resistor, provided the SDOx or SCKx pin is not multiplexed with an ANx analog function. This allows the output to communicate with external circuits without the need for additional level shifters. For more information, see Section 10.1.4 =93Open-Drain Outputs=94. The open-drain output option is controlled by the SPI2OD and SPI1OD bits (ODCON3<1:0>). Setting an SPIxOD bit configures both the SDOx and SCKx pins for the corresponding open-drain operation. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .