OFF
MIKROE-2152
19 g
Status:
2X2 Key Click is a compact add-on board that integrates four buttons into one design. This board features a 2x2 button keyboard with debounce circuit. The debounce circuit is composed of the 74HC32, a quad 2-input OR gate from Nexperia, and the SN74HC14, a Hex Schmitt-Trigger inverter from Texas Instruments. This 2x2 matrix keyboard allows multiple key presses simultaneously and independently read, where each button has its silkscreen marking. This Click board™ makes the perfect solution for the development of Human Machine Interface (HMI) applications.
2X2 Key Click is supported by a mikroSDK compliant library, which includes functions that simplify software development. This Click board™ comes as a fully tested product, ready to be used on a system equipped with the mikroBUS™ socket.
This product is no longer in stock
Availability date:
2X2 Key Click is based on the 2x2 button keyboard with debounce circuit, composed of the 74HC32, a quad 2-input OR gate from Nexperia, and the SN74HC14, a Hex Schmitt-Trigger inverter from Texas Instruments. In electronics, two metal components bounce or create multiple signals when they are in contact with each other — like when you push a button — before they reach a stable state. You want a single contact to be recorded, but the microcontroller records this as if you pressed the button many times. So debouncing is, as the name states, the removal of bounces or spikes of low and high voltages. Graphically speaking, you want a clean line, not spikes. A debounce circuit makes sure that there are no voltage changes on the output. Thanks to it, one button press is recorded as such.
All four Schmitt-trigger outputs are connected to the logic OR gate 74HC32 input pins, whose output is directly connected to the INT pin on mikroBUS. This pin is used to signalize an interrupt to the MCU any time a button is pressed. This way, the MCU software can be implemented as a simple polling routine without any delays programmed in the code (like it would be necessary if there weren’t a hardware debouncing circuit present). Thanks to the INT pin, you can easily program a common interrupt service routine to detect when a button is pressed (the state of the button changes from low to high logic level).
This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the PWR SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Type
Pushbutton/Switches
Applications
Can be used for the development of Human Machine Interface (HMI) applications
On-board modules
74HC32 - a quad 2-input OR gate from Nexperia
SN74HC14 - a Hex Schmitt-Trigger inverter from Texas Instruments
Key Features
2x2 keyboard with debounce circuit composed of quad 2-input OR gate and a Hex Schmitt-Trigger inverter, allows multiple key presses (all 4 buttons simultaneously), interrupt ability, low power consumption, and more
Interface
GPIO
ClickID
No
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V or 5V
This table shows how the pinout on 2x2 Key Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | - | Power LED Indicator |
JP1 | PWR SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | - | 5 | V |
We provide a library for the 2x2 key Click as well as a demo application (example), developed using MIKROE compilers. The demo can run on all the main MIKROE development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for 2x2 key Click driver.
Key functions
This function gets state of AN pin on 2X2_Key Click board.
This function gets state of RST pin on 2X2_Key Click board.
This function gets state of CS pin on 2X2_Key Click board.
This function gets state of PWM pin on 2X2_Key Click board.
Example Description
This example code demonstrates the usage of 2X2 Key Click board.
void application_task ( void )
{
t1_state = c2x2key_t1_state( &c2x2key );
if ( t1_state == 1 && t1_state_old == 0 )
{
log_printf( &logger, "-----------------------rn" );
log_printf( &logger, " Key 1 pressed rn" );
log_printf( &logger, "-----------------------rn" );
t1_state_old = 1;
}
if ( t1_state == 0 && t1_state_old == 1 )
{
t1_state_old = 0;
}
t2_state = c2x2key_t2_state( &c2x2key );
if ( t2_state == 1 && t2_state_old == 0 )
{
log_printf( &logger, "-----------------------rn" );
log_printf( &logger, " Key 2 pressed rn" );
log_printf( &logger, "-----------------------rn" );
t2_state_old = 1;
}
if ( t2_state == 0 && t2_state_old == 1 )
{
t2_state_old = 0;
}
t3_state = c2x2key_t3_state( &c2x2key );
if ( t3_state == 1 && t3_state_old == 0 )
{
log_printf( &logger, "-----------------------rn" );
log_printf( &logger, " Key 3 pressed rn" );
log_printf( &logger, "-----------------------rn" );
t3_state_old = 1;
}
if ( t3_state == 0 && t3_state_old == 1 )
{
t3_state_old = 0;
}
t4_state = c2x2key_t4_state( &c2x2key );
if ( t4_state == 1 && t4_state_old == 0 )
{
log_printf( &logger, "-----------------------rn" );
log_printf( &logger, " Key 4 pressed rn" );
log_printf( &logger, "-----------------------rn" );
t4_state_old = 1;
}
if ( t4_state == 0 && t4_state_old == 1 )
{
t4_state_old = 0;
}
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MIKROE compilers.
This Click board™ is supported with mikroSDK - MIKROE Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.
NOTE: Please be advised that any peripheral devices or accessories shown connected to the Click board™ are not included in the package. Check their availability in our shop or in the YMAN section below.