16f887 PIC output pin pull to ground


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2011
    Posts
    26

    Default 16f887 PIC output pin pull to ground

    Hi,

    I have an external LED board that needs a pin to be pulled to ground to begin its flashing routine. If I connect a wire from ground to this pin it works perfectly.

    How would I control this from an output pin of the 16f887? When the pin is high it is +5v, when it is low it is 0v but not ground. Do I need to use an inverter, etc?

    Thanks for the help

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,580


    Did you find this post helpful? Yes | No

    Default Re: 16f887 PIC output pin pull to ground

    Hi,
    It sounds as if the two boards are missing a common ground.
    The ground of the display board must be connected to ground of the PIC so that they share the same reference.

    /Henrik.

  3. #3
    Join Date
    Jun 2011
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Re: 16f887 PIC output pin pull to ground

    Thanks for the reply.

    The 2 boards do share a common ground. The LED module has 4 pins: +12, GND, Signal 1 and Signal 2. I share the +12 and GND between both boards (+5 is generated through a voltage regulator on each board).

    The specs for the LED board say that you must tie Signal 1 or Signal 2 to ground to control it. So if I connect Signal 1 to GND, it will start flashing one way, and Signal 2 to GND will flash another way. If I do both it flashes a 3rd way, and no pins to GND it will just stay off.

    If the Signal pins needed to be set High to control them, I would just connect them to the PIC outputs on my main board. How can I make it so that I can control this external LED board from the PIC on my main board? ie. How do I tie the signal pins to ground?

  4. #4
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: 16f887 PIC output pin pull to ground

    Since your led board works with 12 volts, i would suggest to use an optotransistor as TLP504 to accomplish your goal.
    Just Connect the two emitters to ground and the two collectors to signal1 & signal2. The diode side will be controlled via your pic using e 330 ohms resistors on both diodes. Turn on the pic pin where you connected the diode and the corresponding NPN optotransistor will ground your control signal input. Mind you totaly isolated from the 12 volts.


    Cheers

    Al.
    All progress began with an idea

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,580


    Did you find this post helpful? Yes | No

    Default Re: 16f887 PIC output pin pull to ground

    If the Signal pins needed to be set High to control them, I would just connect them to the PIC outputs on my main board. How can I make it so that I can control this external LED board from the PIC on my main board? ie. How do I tie the signal pins to ground?
    The output concists of two transistors in a push-pull configuration. When the pin is in output mode (controlled by the TRIS register) one or the other of these two transistors will be on. One "connects" the pin to Vdd (+5V) and the other "connects" the pin to Vss (ground).

    In order to switch PortB.0 low you can do:
    Code:
    Low PortB.0  ' Switch low
    Or the "manual" but prefered way
    Code:
    TRISB.0   'Make PortB.0 an output
    PortB.0 = 0  'Switch low
    That's it really. Now, there are two things to remember:
    1) The pins always come up in input mode meaning you have to switch them to ouputs. This is done thru the TRIS register as shown above but HIGH and LOW handles that for you if you prefer.
    2) Some PICs have analog inputs for the ADC and comparators etc on various pins. If the pins you're trying to use has functions like this they will have to be disabled. Withput knowing which PIC and which pins you're trying to use it's impossible to advise further.

  6. #6
    Join Date
    Jun 2011
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Re: 16f887 PIC output pin pull to ground

    I managed to get it working, it turns out the specs on the board were not very clear. I could connect the output pins of my PIC directly to the signal and set them low. I thought that maybe I would have to do something tricky, but was dead simple.

    Thanks for the help guys.

  7. #7
    Join Date
    Mar 2005
    Location
    Cocoa, Florida
    Posts
    43


    Did you find this post helpful? Yes | No

    Default Re: 16f887 PIC output pin pull to ground

    In the old days a TTL low was not very low, it only had to be below 800mv.
    So an older device (say 74LS04) would give a low of one junction above ground, around 600mv.
    These days most devices (like PICs or 74HCT04) are CMOS, so a low is no longer one bipolar junction voltage above ground, but an impedance above ground.
    The difference is that now the output behaves more like a resistor to ground (an FET), and the value of the low is a function of the current it's sinking, which means it's typically very, very low. Or, if you prefer to round these numbers down: ground.

  8. #8
    Join Date
    Jun 2011
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Re: 16f887 PIC output pin pull to ground

    Ok, I understand now. Thanks kenif!

  9. #9
    Join Date
    Nov 2007
    Location
    Lake Villa Il.
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Re: 16f887 PIC output pin pull to ground

    Hello All,
    Without seeing a complete schematic:
    Be careful as to how much current you are trying to sink!
    Please place a 330 ohm 1/2 watt resistor this limits the current that the pic output is switching to 15 ma. Or use a 200 ohm 1/2 watt to limit current to 25 ma, the MAXIMUM that the pin is rated for.

    Just a thought,

    Terry K9HA

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts