Matrix Keypad routine


Closed Thread
Results 1 to 40 of 135

Hybrid View

  1. #1
    Join Date
    May 2007
    Location
    Harvest, Alabama
    Posts
    10


    Did you find this post helpful? Yes | No

    Unhappy Pullup resistors

    How do we determine what the pullup should be? I mean 100 to 300 ohms or 10 K ohms doesn't exactly give me the data I need. (Does it vary with the circuit being driven for example?) I really want to trigger the circuit with a minimum of time so I want the pullup fast so that my transistors (Nice NPN's for switching) with about 4.7 K ohms lead in resistance trigger off pretty much as fast as any current comes on the pin to signal it.

    I will be pushing a signal in the switch of the NPN transistor so that there is some current to pull a MOSFET fast. I need some current to move like NOW.

    In any case since I just cooked a $15 chip and an X1 Board , I really want to know some answers. (I just burned up some money) I need to know what voltage appears on the pins of the chip when we set for example a PORTA.2 =1. or PORTA.2 = 0 Is it on PORTA.1 = 1 a positive or negative voltage. It was logic testing that cooked this equipment.

    All advice will be appreciated.

    Well I got a cross of a posting that occurred between my post and an answer.

    The issue of Pullups seems to be a feature of the pin to cause it to draw some current to make it pull down a few thousandths of an ampere so that the circuit stays logic stable. I would think that if I am driving a transistor as I am the obvious value to use is about 10K because the transistor will have a 4.7 K or so leading out of the logic pin into the transistor Emitter. Or does this 4.7 to Vss draw down enough power so that the transistor needs no other resistor on the emitter?

    Generally a 5 VDC to emitter of a switching transistor with logic state high would take a 4.7 K ohm in the way of the signal feeding into the emitter (P of the NPN). If you take a 5 VDC state with a 10 K ohm to Vss and the positive voltage on the pins as high logic state then a 4.7 to the emitter should keep enough current to the transistor to open the gate so I am guessing based upon the previous answer that a 10 K ohm is in order (???)

    When we change from an input drain state as in the keyboard to an output control state, I would suspect that we add a current to bring the pin near switch on state but just below in order to logically control things, Is this so?


    Thanks
    Last edited by CluckShot; - 18th June 2007 at 00:52. Reason: cross posting

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


    Did you find this post helpful? Yes | No

    Default

    For Switchs, Keypad the Pull-up value is not really important. 10K is common, that's what i use. They can be higher... but i stick with 10K.

    For switches and Keypad, yes you could use the internal one without having too much problem.

    If you don't use any, this will cause you some problem as the internal gate don't see a logic level... it will see noise, so it will react weird. It has nothing to do with the Output driver, as the pin is set as Input. And BTW, if you enable ALL internal pull-up, they will be disabled on all Output configured I/O.

    <hr>PORTA.x = 1 = 5Volt
    PORTA.x = 0 = 0Volt<hr>

    To drive a transistor (NPN/PNP) you need a resistor in serie with the base, unless you will burn the I/O. Roughly, if you don't insert a resistor in serie with the transistor base, the i/O will see only a diode, as there's no current limiting resistor the current will be infinite. I=E/R, I=Vdd/0 hence some obvious damage to the PIC which can't provide more than 25mA by I/O, and x/PORT.

    The base resistor will have to be calculated. But you need to know how much current your transistor will drive and the transistor Hfe. The base resistor have to be higher than Vdd/25mA to avoid burning the I/O and few time lower than the calculated one to ensure proper switching.

    rb=Vdd-0.7/(Ic/Hfetyp)

    HTH
    Last edited by mister_e; - 18th June 2007 at 01:17.
    Steve

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

  3. #3
    Join Date
    May 2007
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Steve

    Does the same apply to driving a n-channel power mosfet?
    I would like to drive a IRFP250N n-channel mosfet.
    (for this mosfet the static drain-to-source on-resistance Rds(on)=0.075ohm,
    drain-to-source leakage current Idss = 25-250uA)
    Do I also need a resistor inbetween the mosfet and the output pin?
    If so, should I use the same calc as above to determine the ohm value of the resistor?

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


    Did you find this post helpful? Yes | No

    Default

    in theory, you don't need any resistor in between as the gate impedance and their gain(not the right term but.. ) is quite large . BUT if you worry of a Gate to Source short, or else weird stuff, you should use a resistor in serie to 'protect' the PIC.
    Steve

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

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    ... you should use a resistor in serie to 'protect' the PIC.
    If your concern is speed then
    this res should be as low as possible, 0-470 Ω.
    Else
    use larger one about 1K
    Endif

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default

    I tend to not use any resistor. If i need to drive high current, i sure use something else in between...
    Steve

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

  7. #7
    Join Date
    May 2007
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Thank you Steve & Ioannis.

    Steve, what do you mean with:
    "If i need to drive high current, i sure use something else in between..."

  8. #8
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by CluckShot View Post
    How do we determine what the pullup should be? I mean 100 to 300 ohms or 10 K ohms doesn't exactly give me the data I need. (Does it vary with the circuit being driven for example?)
    I was taught, back in the "old days", to figure for about 1 ma to flow in the pullup (or, when needed, pulldown). Thus for 5-volt TTL, 4.7K; for 12-volt CMOS logic, 10K. I still use these values without thinking, and everything still works.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  9. #9
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by CluckShot View Post
    How do we determine what the pullup should be? I mean 100 to 300 ohms or 10 K ohms doesn't exactly give me the data I need. (Does it vary with the circuit being driven for example?)
    I was taught, back in the "old days", to figure for about 1 ma to flow in the pullup (or, when needed, pulldown). Thus for 5-volt TTL, 4.7K; for 12-volt CMOS logic, 10K. I still use these values without thinking, and everything still works.
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

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


    Did you find this post helpful? Yes | No

    Default

    I think that's for a standard 10 TTL loads.

    But a PIC pin is only 1 load. So you can be fine with 40K, which is somewhere around the range of the internal weak pull-ups.
    <br>
    DT

  11. #11
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    I think that's for a standard 10 TTL loads.

    But a PIC pin is only 1 load. So you can be fine with 40K, which is somewhere around the range of the internal weak pull-ups.
    <br>
    I'm sure you're correct, Darrel. As I wrote, that was a long time ago. My feeble point was, I still automatically use that thumb rule and those values and the circuits still work. (Probably kind of like driving a tack with a sledgehammer . . . )
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

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


    Did you find this post helpful? Yes | No

    Default

    Or shooting Quail with a Deer slug.

    But keep in mind we're talking keypads here.
    For something like high speed communication with I2C, lower values are required to overcome any capacitance that might cause a Slew Rate.

    In which case 4.7K is the perfect value.

    I'd say, just keep doing what you're doing, and you should be fine.
    <br>
    DT

Similar Threads

  1. calculator-like code entry with matrix keypad and display
    By Dennis in forum mel PIC BASIC Pro
    Replies: 35
    Last Post: - 16th December 2009, 22:58
  2. Need help in matrix keypad coding
    By rano_zen06 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 24th May 2008, 13:16
  3. I2C PCF8574 4X4 Keypad routine
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th January 2007, 21:25
  4. Inconsistent output on a 4x4 matrix keypad
    By markcadcam in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 24th November 2006, 03:54
  5. very basic matrix keypad question
    By kitcat in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th July 2006, 21:33

Members who have read this thread : 2

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