Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

i got very weird problem with keypad with pic24......

Status
Not open for further replies.

Strike_UN

Junior Member level 1
Joined
Mar 9, 2012
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,372
iam just doing simple keypad with pic24 but i dont know why its not working properly here is my code
Code:
sbit enter at portg.b2;

sbit LCD_RS at LATD0_bit;
sbit LCD_EN at LATD1_bit;
sbit LCD_D4 at LATB0_bit;
sbit LCD_D5 at LATB1_bit;
sbit LCD_D6 at LATB2_bit;
sbit LCD_D7 at LATB3_bit;

sbit LCD_RS_Direction at TRISD0_bit;
sbit LCD_EN_Direction at TRISD1_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;

unsigned keypadPort at PORTE;
unsigned keypadPort_Direction at TRISE;

unsigned short kp;
unsigned char var_array[1];
unsigned char key_array[60];
unsigned int k=0;
unsigned int enter_f=0;

void main() {
Keypad_Init();
Lcd_Init();
lcd_cmd(_lcd_cursor_off);
lcd_out(1,3,"start up");
delay_ms(1000);
lcd_cmd(_lcd_clear);
while(1){
kp = Keypad_Key_click();
if(kp!=0){
switch (kp) {
      case  1: kp = 49; break; // 1        // Uncomment this block for keypad4x4
      case  2: kp = 50; break; // 2
      case  3: kp = 51; break; // 3
      case  4: kp = 65; break; // A
      case  5: kp = 52; break; // 4
      case  6: kp = 53; break; // 5
      case  7: kp = 54; break; // 6
      case  8: kp = 66; break; // B
      case  9: kp = 55; break; // 7
      case 10: kp = 56; break; // 8
      case 11: kp = 57; break; // 9
      case 12: kp = 67; break; // C
      case 13: kp = 42; break; // *
      case 14: kp = 48; break; // 0
      case 15: kp = 35; break; // #
      case 16: kp = 68; break; // D
}
var_array[0]=kp;
lcd_out(1,1,var_array);
kp=0;
}
if(enter==1&&enter_f==0){
enter_f=1;
key_array[k]=var_array[0];
lcd_out(2,1,key_array);
k++;
}
if(enter==0){
enter_f=0;
}
}
}
no problem in build but when i try on proteus there is no o/p
and here is the circuit i drew i know the keypad is upside down but i just wanna see output -.-
keypad.PNG
 

According to your circuit diag, neither the microcontroller nor the LCD are receiving any power...
 

According to your circuit diag, neither the microcontroller nor the LCD are receiving any power...

in proteus there is no need to add power supply its auto supplied and if u tryed to connect it like that both lcd and pic will work properly the problem in the keypad nothing more
 

read the data sheet of the keypad carefully
specifically about the debounce delay
you should know about the proper debounce delay of the keypad and adjust it for the proper execution
i hope this will help



.... happy to help
i_chaitanya
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top