Controlling switches with a PIC


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Sep 2007
    Posts
    50


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by TonyA View Post

    Would the 5V dc wire (connected to "C") be brought to ground when the pic pin is high?

    The 2n2222 is an NPN BJT transistor.

    See: http://en.wikipedia.org/wiki/2N2222

    Yes, when voltage is applied to the base, current will flow from C to E. When the base is low, there is no flow.
    Best Regards,

    Kurt A. Kroh
    KrohTech

    “Goodbye and thanks for all the fish”

  2. #2
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Thanks for the help, I appreciate it.

    Would the 2n2222 work for my application? (i.e. just pulling a 5V wire to ground?) Which transistor would you recommend?

    Thanks again,

    TOny
    Last edited by TonyA; - 4th March 2008 at 22:17.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by TonyA View Post
    Thanks for the help, I appreciate it.

    Would the 2n2222 work for my application? (i.e. just pulling a 5V wire to ground?) Which transistor would you recommend?

    Thanks again,

    TOny
    Use the 2N2222. As long as you aren't pulling a zillion amps thru it, you'll be fine.
    Just make sure you read and understand how to do so...

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by TonyA View Post
    (i.e. just pulling a 5V wire to ground?) Which transistor would you recommend?
    None!

    Just use the Tri-State output of the PIC.

    Code:
    PORTB.0 = 0   ; Pin goes to gnd when not Tri-Stated
    
    TRISB.0 = 0   ; Output to Ground
    ;....
    TRISB.0 = 1   ; Output Tri-Stated
    Added:
    If there's any possibility that the external 5V is higher than the PIC's 5V?
    Use PORTA.4 instead. It doesn't have the VDD voltage limit.<br>
    Last edited by Darrel Taylor; - 4th March 2008 at 23:04. Reason: RA4
    DT

  5. #5
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Darrel, and FalingTrea thanks. I was wondering about that. Thanks again.

    Tony
    Last edited by TonyA; - 5th March 2008 at 01:06.

Similar Threads

  1. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 15:46
  2. Controlling stepper motor with PIC
    By The Master in forum Off Topic
    Replies: 3
    Last Post: - 1st July 2008, 11:21
  3. Controlling power to a PIC with another PIC
    By jswayze in forum Off Topic
    Replies: 3
    Last Post: - 28th May 2005, 20:44
  4. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th March 2005, 00:14
  5. Battery Backup with PIC controlling switch
    By Dwayne in forum Schematics
    Replies: 1
    Last Post: - 27th December 2003, 14:16

Members who have read this thread : 0

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

Posting Permissions

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