Cari Blog Ini

Diberdayakan oleh Blogger.
Jumat, 28 September 2012

Interfacing Keypad with PIC16F877A in C program using MPLAB X

Interfacing Keypad with PIC16F877A in C program using MPLAB X - welcome to the blog Software Gadget the end of this much calm product information launcing, yes every day there are always products that are removed from various brands, both physical hardware products and software that need new knowledge to use it, well now we will discuss first about Interfacing Keypad with PIC16F877A in C program using MPLAB X as you search we have collected a lot of data to make this information as complete as possible for you, please read:

Articles : Interfacing Keypad with PIC16F877A in C program using MPLAB X
full Link : Interfacing Keypad with PIC16F877A in C program using MPLAB X

You can also see our article on:


Interfacing Keypad with PIC16F877A in C program using MPLAB X

This tutorial will show you how to read a 4x4 keypad input and write to an alphanumeric LCD interfaced to your PIC micro, it's pretty simple and straight forward.

First create a new project and add a c main file like in the  steps for  Blinking a LED using MPLAB X , PIC16F877A
Components
1.PIC16F877A micro controller
2. 4x4 matrix keypad

initial setup
 supply logic 0 (0V or GND) to all 4 keypad row wires or set the row pins as output
 Supply logic 1 (high voltage) to all 4 keypad coloum wires or set coloums  as input


Steps to read a key from the keypad 
1. Find the Row first, by selecting each row
2. scan the colum  which pressed key is
3 Find the key pressed ,the function findKey() is for this


4. If we have at least one key pressed, then return from keypadread()  will be non zero.






PROGRAM 
#######################################################################
    /*
 * File:   main.c
 * Author: Ebin Ephrem
 
 */


#include<htc.h>

#if defined(WDTE_OFF)
__CONFIG(WDTE_OFF & LVP_OFF);
#elif defined (WDTDIS)
__CONFIG(WDTDIS & LVPDIS);
#endif

char findKey(unsigned int a, unsigned int b);
char readKeyboard();

void main()
{  
   TRISB = 0xF0;

unsigned int re;   
 while(1)
    {
        re=0;
        re= readKeyboard();
    }
}
char readKeyboard()

{
 unsigned int i = 0;
 for(i=0;i<4;i++)
 {
  if(i == 0)
  PORTB = 1;
  else if(i == 1)
  PORTB = 2;
  else if(i == 2)
  PORTB = 4;
  else if(i == 3)
  PORTB = 8;

  if(RB4)
    return findKey(i,0);
  if(RB5)
   return findKey(i,1);
  if(RB6)
   return findKey(i,2);
  if(RB7)
   return findKey(i,3);
 }
 return ' ';
}
char findKey(unsigned int a, unsigned int b) //generating key character 
{

 if(b == 0)
 {
   if(a == 3)
    return '3';
   else if(a == 2)
    return '2';
   else if(a == 1)
    return '1';
   else if(a == 0)
    return '0';
 }
 else if(b == 1)
 {
   if(a == 3)
    return '8';
   else if(a == 2)
    return '7';
   else if(a == 1)
    return '6';
   else if(a == 0)
    return '5';
 }
 else if(b == 2)
 {
   if(a == 3)
    return 'b';
   else if(a == 2)
    return '8';
   else if(a == 1)
    return 'A';
   else if(a == 0)
    return '-';
 }
 else if(b == 3)
 {
   if(a == 3)
    return 'C';
   else if(a == 2)
    return 'U';
   else if(a == 1)
    return 'E';
   else if(a == 0)
    return 'F';
  }
}

######################################################################


you can modify the number of colums and rows for 3x4 keypad , and for the other keypads





so much information Interfacing Keypad with PIC16F877A in C program using MPLAB X

hopefully the information Interfacing Keypad with PIC16F877A in C program using MPLAB X that we provide can be useful for you in the set of technology products that fit your daily needs,

have just read the article titled Interfacing Keypad with PIC16F877A in C program using MPLAB X if you feel useful information and you want to bookmark or share please use the link https://ramblingsofker.blogspot.com/2012/09/interfacing-keypad-with-pic16f877a-in-c.html and do not forget to go back to this blog if you want to know information about the latest gadgets.

Tag :
Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : Interfacing Keypad with PIC16F877A in C program using MPLAB X

3 komentar:

  1. Geek Squad tech support to some researches done by specialists, breaching is caused by internet phishing. Internet phishing harms your websites, data, credentials, and the information within your computer. Geek Squad phone number to save your device from malware and the like, you need proper internet security like Webroot antivirus. Geek Squad support facing some error with your smartphone? Or, its your DSLR camera which is bothering you? Geek Squad Appointment matter whatever the issue, we are always here to help you. Whenever you find some error with your daily useful stuff- get in touch with our Geek Squad Tech Support. Webroot geek squad a telephonic conversation with our experts and get the resolutions. Our dynamic chat support portal lets you connect with the engineers within a few minutes. Scroll down to know more about our service offerings. Best buy geek squad | Geek Squad chat

    BalasHapus
  2. It provides a safe and secure way to exchange money. PayPal accounts can be used for online transactions and online shopping. Before getting to know how to create your PayPal account, you must decide which type of account you want to create.

    For more information visit site :- Paypal Login

    BalasHapus
  3. Additionally, amazon invests a lot in its own original show that makes Amazon Prime Video even more astonishing. Various glitches do show up from time to time, affecting thousands or even millions of users. By the way, login problems account for 50 percent of the total issues reported by users. Let’s explore why they occur in the first place and how you can fix them.

    For more information visit site :- amazon.com/code
    amazon.com/code
    Paypal Login

    BalasHapus