element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Embedded Forum FRDM-KL25Z
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 2 replies
  • Subscribers 480 subscribers
  • Views 453 views
  • Users 0 members are here
  • keypad
  • mbed
Related

FRDM-KL25Z

Former Member
Former Member over 12 years ago

Hello members,

I recently purchased a FRDM-KL25Z from Newark. After receiving it and messing with examples programs I decided to try to use a 4x4 matrix keypad. The information regarding it was already available from HM Yoong Link: Keypad - Cookbook | mbed . My problem is that to have it display what keys were pressed I would have to press the button on the matrix keypad then hit the reset button for it to display the keys on the screen. Furthermore it only seems to allow one button to output; a second button press will not register or display. I have tried numerous changes to the code and even asked assistance on the mbed Questions but with no avail. After seeking help from mbed IRC, a member have informed me that the LPC1768 used a Internal Pull Down. Which maybe different from the KL25Z but does not have the device to determine it. I've tried to find sources online backing the person's information but with no luck.

 

Any Assistance and or suggestions would be greatly appreciated.

 

Some attempts that have been made:

Adding a 10k resistance on the columns pins. Visa Versa

Changing Pin numbers on the program to match KL25Z pin layout

 

The current program is very similar to the Author's Original since I wanted to test it if it's in working condition prior to integrating it to my program.

 

Source Code:

#include "mbed.h"
#include "rtos.h"

#include "Keypad.h"

Serial        PC(USBTX, USBRX);
RtosTimer    *LedTimer;
DigitalOut    Led1(LED1);
DigitalOut    Led2(LED2);

// Define your own keypad values
char Keytable[] = { '1', '2', '3', 'C',   // r0
                    '4', '5', '6', 'D',   // r1
                    '7', '8', '9', 'E',   // r2
                    'V', '0', 'N', 'F'    // r3
                  };
                 // c0   c1   c2   c3

int32_t       Index = -1;
int           State;

uint32_t cbAfterInput(uint32_t index)
{
    Index = index;
    return 0;
}

void Blink(void const *arg) {
    if (State == 1)  {
        Led1 = 1;
        Led2 = 0;
        State = 2;
    }
    else if (State == 2)  {
        LedTimer->stop();
        Led1 = 0;
        Led2 = 1;
        LedTimer->start(2000); // longer timer alarm
        State = 1;
    }
}

int main()
{
    PC.printf("I am Demo Keypad\r\n");
    State = 1;
    LedTimer = new RtosTimer(&Blink, osTimerPeriodic, NULL);
    LedTimer->start(500); // short timer alarm    
    
    //             r0   r1   r2   r3   c0   c1   c2   c3
    Keypad keypad(PTD4, PTA12, PTA4, PTA5, PTA13, PTD5, PTD0, PTD2, 20);
    keypad.attach(&cbAfterInput);
    keypad.start();  // energize the columns c0-c3 of the keypad

    while (1) {
        __wfi();
        if (Index > -1) {
            PC.printf("Interrupted");
            PC.printf("Index:%d => Key:%c\r\n", Index, Keytable[Index]);
            Index = -1;
        }
    }
}

 

-VivaPenguinos-

  • Sign in to reply
  • Cancel
  • vsluiter
    0 vsluiter over 12 years ago

    Andy Lau wrote:

    Adding a 10k resistance on the columns pins. Visa Versa

    Hi Andy,

     

    Do you mean a 10k pulldown or pullup?

    I think I read in one of the comments on the Cookbook that the NXP originally used  has pulldowns on the interrupt pins. That means you should only have to add pulldowns on the InterruptIn pins, which are the rows (in your case PTD4, PTA12, PTA4, PTA5).

    Do you have a scope to see what the signals look like?

     

    Greetings,

    Victor

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 12 years ago in reply to vsluiter

    Unfortunately I don't have a scope to see what the signals look like so I'm flying blind. I'm using pull down resistor on the columns and still no luck.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube