CrazyEngineers
  • Hi all,😁

    can you guys help me with: how to input a value from a keypad (say a keypad having 4 numbers; 1,2,3 and 4) into a microcontroller and the latter reads the number entered?

    e.g. i want the microcontroller to know that my system must shutdown when the bump sensor reads '2', i.e it hits something twice. So when i pressed the key '2', the microcontroller gets the value '2' and will compare it with the bump count. But i don't know how to do it.😕

    i am thinking of using 4 different switches, each defining numbers 1 to 4. but this would occupy 4 ports.. so guys can this be done using ONLY ONE PORT? 😒

    please reply soon.

    regards,
    Satanas
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • reachrkata

    MemberFeb 27, 2010

    Sure can. You can do it with a single ADC port.

    Connect the ADC port to the supply via a 47k pull-up (say).
    Next, connect different pull-downs to the same port through the 4 keys.
    For example, Connect the ADC port to GND via a 1K and Key 1.
    Again connect the ADC port to GND via a 2K and Key 2.... and so on.

    When no key is pressed, the ADC detects Vcc. When Key 1 is pressed, the ADC detects the voltage due to potential divide of 47k and 1k.
    ..... and so on.

    -Karthik.
    Are you sure? This action cannot be undone.
    Cancel
  • satanas

    MemberFeb 27, 2010

    Hi Karthik,

    thanks for the tip.. i will try it right away..

    cheerz.

    regards.
    satanas
    Are you sure? This action cannot be undone.
    Cancel
  • satanas

    MemberMar 1, 2010

    Hi,

    i tried it but things are not working.. can you provide me with the circuit please-resistors values? the supply is 5V and am sure i did something wrong.. so please help me.. i have limited time. i would be very grateful to you guys..

    regards,
    satanas
    Are you sure? This action cannot be undone.
    Cancel
  • reachrkata

    MemberMar 1, 2010

    Perhaps this clarifies everything -

    [​IMG]
    -Karthik
    😁
    Are you sure? This action cannot be undone.
    Cancel
  • Ashraf HZ

    MemberMar 1, 2010

    In all honesty, I never thought of that kind of approach before 😛
    Are you sure? This action cannot be undone.
    Cancel
  • reachrkata

    MemberMar 5, 2010

    No sweat Ash !! i too learnt it only in my company !!!

    -Karthik
    😁
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register