Pullups and pulldows


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by xnihilo View Post
    Sure, it is a lasergame system. the mag module performs a handshaking with the gun module. i.e. gun asks the mag if there are still ammo in the mag. if there are, the gun receives a signal and the ammo is used.

    there are 2 pics 16f684 communicating. the mag ra5 is set as input and used at default low state (porta.5=0, wpu disabled).
    when the gun sends a +5v to mag's ra5 for 1ms, mag then sets ra5 as output and it sends +5v out via ra5 to the gun as a reply then ra5 is set again as input at logic low. this ra5 pin is used as input/output for handshaking. TRISA is used to chang pin direction as needed.
    so my trouble is, if i use an external 10k weak pulldown to avoid leaving it floating (and triggering a fake int on ra5 if there is some noise) i won't be able to disable the pull down in software when i'll be using the pin as output. do you see?
    There should be no problem with using a 10k pull-down resistor. So the gun pin (the one that's connected to RA5 of the mag) goes to an input immediately after sending a 1ms high signal? This pull-down resistor would therefore stop the gun input pin floating as well.

    Please correct me if I've mis-interpreted you

    Cheers

    Rob

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I agree with Rob.
    You can have an external pull up or down and still do what you want.
    Think of it like this.

    If you had a switch connected to a pin (input) that is set to receive a high signal when the switch is closed you would have a pull down resistor to hold the pin low so not to give a false reading.

    If you had a mosfet or relay connected to a pin (output) that is set to go high to activate the mosfet or relay you would have a pull down resistor to hold the pin low so not to have the mosfet or relay coming on when is is not supposed to.

    The thing I will suggest in your case is a 100K pull down might be better. It should increase the sensitivity.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Problem when switching internal-pull up could be some false interrupts events. Your software MUST compensate for it. But i see no advantage to do so.... too bad... i can't take beer 'till few months ... in some occasion, it's an eye opener
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    too bad... i can't take beer 'till few months ... in some occasion, it's an eye opener
    HUH? No beer? Whats up?
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Long story PM or e-mail....
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    What will happen when the 5V output is sent. As there is a 10K weak pullup connecting the pin to the ground... I guess some current will sink to the ground but most of it will reach the target pic, right?
    Yep, that is why I think a 100K might be better in you situation.
    I think
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I'm kinda lost in here... sorry And there's some danger also.. unless you also use a current limiting resistor between your PIC and the mag.... hence why i asked for a schematic awhile back... and weak pull-up can't be tied to GND... unless it would be pull-down.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Smile

    I will make a schematic/diagram with the stuff by draw it by hand will be a mess. I will try to understand how to use EAGLE pcb designer so I make some decent diagram.

    In the meantime, as I said, the two pics have to communicate using each one porta pin.

    The communications is:
    Gun-PIC send +5V to Mag-PIC who then turns its pin as output and sends back a +5v to the Gun-PIC.

    I'll make my schematics and system description and source available on my website by the end of the week.

    Anyway THANKS a lot for your help guys.

  9. #9
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    I'm kinda lost in here... sorry And there's some danger also.. unless you also use a current limiting resistor between your PIC and the mag.... hence why i asked for a schematic awhile back... and weak pull-up can't be tied to GND... unless it would be pull-down.
    Sure, pull-down because I use the pin in low state so to avoid the pin to be left floating I tie it to GND, I read it is a good practice.

  10. #10
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Rob View Post
    There should be no problem with using a 10k pull-down resistor. So the gun pin (the one that's connected to RA5 of the mag) goes to an input immediately after sending a 1ms high signal? This pull-down resistor would therefore stop the gun input pin floating as well.

    Please correct me if I've mis-interpreted you

    Cheers

    Rob
    In fact RA5 of the PIC used in the gun is connected to RA5 of the pic used in the mag.
    Pins used for this handhasking, both in the gun and in the mag are used both as input and output in a specific sequence.

    GUN (with weak PD) MAG (with 10K external weak pull down)

    RA5 RA5

    OUTPUT, LOW INPUT, LOW
    Set high for 1ms Portachange interrupt is triggered, goto int handler
    1ms delay RA5 becomes an output pin
    RA5 becomes input RA5 starts outputing 5V ONLY if an ammo is available in the mag
    start polling RA5 2ms delay
    RA5 reverts to output RA5 reverts to input
    Here the gun either received a 5V pulse on RA5 (got an ammo from the mag) or no pulse was received, which means mag is empty
    The respective programs continue...

    That's how I implemented my handshaking between the pics. I would have used separate pins one for input, one for output for each pic but I don't have enough free pins, anyway, such usage of the pic should be okay anyway

    What will happen when the 5V output is sent. As there is a 10K weak pullup connecting the pin to the ground... I guess some current will sink to the ground but most of it will reach the target pic, right?

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