Keypad With LCD Using CloudX Microcontroller

by DwealthJossy in Circuits > Microcontrollers

367 Views, 0 Favorites, 0 Comments

Keypad With LCD Using CloudX Microcontroller

KEYPAD WITH LCD.BMP

For this project, we will accept data from a Matrix Keypad and then display it on an LCD

Module.

COMPONENT NEEDED

cloudx.jpg
V3 CORD.jpg
lcd.jpg
4x4-keypad-matrix.jpg
variable-trimpot.jpg
JUMPER.jpg

  • CLOUDX MICROCONTROLLER
  • CLOUDX SOFTCARD
  • V3 USB CORD
  • LCD 16x2
  • KEYPAD 4x4
  • VARIABLE RESISTOR (103)
  • JUMPER WIRE

You can get your component here

SETTING UP YOUR HARDWARE

KEYPAD WITH LCD.BMP
16x2-LCD-Pinout.png
keypad.jpg
variable-trimpot.jpg

first step:

LCD connection: we re going to use data 4 - data 7 pin, register select pin, enable pin.

  • connect RS pin to pin1 of the Microcontroller
  • connect EN pin to pin2 of the Microcontroller
  • connect D4 pin to pin3 of the Microcontroller
  • connect D5 pin to pin4 of the Microcontroller
  • connect D6 pin to pin5 of the Microcontroller
  • connect D7 pin to pin6 of the Microcontroller
  • connect Vss and led negative pin to GND
  • connect Vdd and led positive pin to 5v
  • connect the variable resistor middle pin to VE(contrast V). and the other pin to 5v and GND.

Second step:

Keypad connection: we are using pullDown resistor for the keypad column pins.

  • The pin1 of the keypad column pin was connected to 10k resistor and to pin11 of the microcontroller.
  • The pin2 of the keypad column pin was connected to 10k resistor and to pin12 of the microcontroller.
  • The pin3 of the keypad column pin was connected to 10k resistor and to pin13 of the microcontroller.
  • The pin4 of the keypad column pin was connected to 10k resistor and to pin14 of the microcontroller.

And the end of the resistor was connected together to GND.

  • The pin1 of the keypad Row pin was connected to pin7 of the microcontroller.
  • The pin2 of the keypad Row pin was connected to pin8 of the microcontroller.
  • The pin3 of the keypad Row pin was connected to pin9 of the microcontroller.
  • The pin4 of the keypad Row pin was connected to pin10 of the microcontroller

After achieving it, let go to coding.

if you want to download CloudX IDE click here

CODING

Copy this code to your CloudX IDE.

#include <CloudX\M633.h>
#include <CloudX\Lcd.h> #include <CloudX\Keypad.h>
#define NumberOfRows 4 // set the number of ROWS for Keypad
#define NumberOfColumns 4 // set the number of COLUMNS for Keypad
char KeypadCharacters[NumberOfRows][NumberOfColumns] = {
 '1','2','3','A',
 '4','5','6','B',
 '7','8','9','C',
 '*','0','#','D'
 }; //layout of the Keypad’s Keys
char RowPins[NumberOfRows] = {7, 8, 9, 10}; // Keypad’s Row Pins to CloudX
char ColumnsPins[NumberOfColumns] = {11, 12, 13, 14}; // Keypad’s Column Pins
char Keys; //store Keypad output here
setup(){
 //setup here
 Lcd_setting(1,2,3,4,5,6);
 Lcd_cmd(cursorOff);
 Lcd_cmd(clear);
Keypad_setting (PULLDOWNCOL, RowPins, ColumnsPins, NumberOfRows, NumberOfColumns,
KeypadCharacters); // initialize Keypad with these data
loop(){
 //Program here
 while(Keys==0) //if no Key is Pressed keep checking for a Key Press
 Keys=Keypad_getKey();//if a Key is Pressed load Key data into the Keys variable
 Lcd_writeCP(Keys); // Display the Key Pressed on LCD’s Current Cursor Position
 Keys=0; //Clear the Content of the Keys variable
 }
}

Share With Us

Did you achieve it?

if you achieve it share it us here