open drain or push pull

Discussion in 'General Electronics Chat' started by gdallas, Jun 10, 2014.

  1. gdallas

    Thread Starter Member

    Apr 25, 2012
    I need to use a couple of PIC digital outputs for SPI chip select pins and a third for enabling comms in a particular direction on my MAX485. What’s not clear to me is what the output type are in these PICs; 18f87jk22, i.e. open drain, push-pull etc. my thoughts are, if this is Open drain I guess I will need to provide a pull up at the input to the devices I’m interfacing with, however if the PIC output was push pull then it would drive to either logic without the need for a pull-up/down resistor. On a previous job I used a similar pin to chip select and hadn’t used a pull up and received no issues, but this could be a fluke I guess.

    One of the pins are as follows, the rest are identical:
    Pin Name: RH1
    Pin Type: I/O
    Buffer Type: ST (Schmitt trigger input with CMOS levels)
    Description: Digital IO
  2. MrChips


    Oct 2, 2009
    Did you check the data sheet?

    How did you configure the SPI ports?
  3. gdallas

    Thread Starter Member

    Apr 25, 2012
    yes, first thing i done, SPI are default totems i believe and wont require pullups, but "CAN" be doncifgured open drain in pic if required. I susspect that in my case, its pushpull for standard output logic so no pull ups required. Thats the conculsion i have come to anwyay.
  4. JohnInTX


    Jun 26, 2012
    PORTH on an 18F87K22 does not do open drain (as a general purpose IO) but it IS shared with analog and comparator and CCP functions. You'll have to the analog off with ANCONx and ODCON and not configure any CCP that may use the pin for a PWM output etc.

    This port will source / sink only 2ma. Its 5V tolerant at VDD=5V.

    Hope this helps. I don't see an 87JK22 or 87J22. Typo?

    Good luck!
  5. BobTPH

    Active Member

    Jun 5, 2013
    PIC outputs are almost always push-pull. But you can make them open drain by switching it to an input when the desired output is high.