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.

external interrupt using by keypad encoder 74c922

Status
Not open for further replies.

denesio

Junior Member level 1
Junior Member level 1
Joined
Mar 20, 2007
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,391
here is a code:

Code:
.
.
.
.
.
.
const char key_table[16] = "123A456B789C*0#D";
unsigned char key;
//unsigned char ex0_isr_counter = 0;

void ex0_isr (void) interrupt 0
{
//ex0_isr_counter++;   // Increment the count
unsigned char keypad_scan;
    key = ((keypad_scan=keypad_address)&keypad_mask);
  	key = key_table[key];
	goto_xy(0,0);
	putch_lcd(key); 
}
.
.
.
.
.
.
.
   while(1)
    	{
.
.
.
.
if (key == 4)
{
   goto_xy(2,0);
   putch_lcd(0xe4); 
   Puts("vse-vse");
   }
.
.
.
.
}


why in first time the message is printed to lcd (interrupt isr),
and second time is not (if (key == 4)).......
"key" is global variable..........
 

which microcontroller are you using. See my code for AVR microcontroller
**broken link removed**

Bibin John
www.bibinjohn.tk
 

i am using 89c51rd2..
it is working properly now...
Code:
#define keypad_mask 0x0F 
#define keypad_address (*((unsigned char xdata*)0x8007)) 
. 
. 
. 
const char code key_table[16] = "123A456B789C*0#D"; 
unsigned char key; 
unsigned char key_lcd; 
. 
. 
. 
void ex0_isr (void) interrupt 0 
{ 
unsigned char keypad_scan; 
key = ((keypad_scan=keypad_address)&keypad_mask); 
key_lcd = key_table[key]; 
goto_xy(19,0); 
putch_lcd(key_lcd); 
} 
. 
. 
. 
. 
. 
switch (key) 
{ 
// goto_xy(1,1); 
case 0 : LCD_clear_row(1); goto_xy(0,1); Puts(buffer); goto_xy(17,0); putch_lcd('0'); break; 
case 1 : LCD_clear_row(1); goto_xy(0,1); rtc_time_to_lcd1(); goto_xy(17,0); putch_lcd('1'); break; 
case 2 : LCD_clear_row(1); goto_xy(17,0); putch_lcd('2'); break; 
case 3 : LCD_clear_row(1); goto_xy(17,0); putch_lcd('3'); break; 
case 4 : LCD_clear_row(1); goto_xy(17,0); rtc_read_reg(); rtc_reg_to_lcd(); goto_xy(17,0); putch_lcd('4'); break; 
case 5 : LCD_clear_row(1); goto_xy(0,1); rtc_reg_to_lcd1(); goto_xy(17,0); putch_lcd('5'); break; 
case 6 : LCD_clear_row(1); goto_xy(17,0); putch_lcd('6'); break; 
case 7 : LCD_clear_row(1); goto_xy(17,0); putch_lcd('7'); break; 
case 8 : LCD_clear_row(1); goto_xy(17,0); putch_lcd('8'); break; 
case 9 : LCD_clear_row(1); goto_xy(17,0); putch_lcd('9'); break; 
case 10 : LCD_clear_row(1); goto_xy(17,0); putch_lcd('A'); break; 
case 11 : LCD_clear_row(1); goto_xy(17,0); putch_lcd('B'); break; 
case 12 : LCD_clear_row(1); goto_xy(17,0); putch_lcd('C'); break; 
case 13 : LCD_clear_row(1); goto_xy(17,0); putch_lcd('D'); break; 
case 14 : LCD_clear_row(1); goto_xy(17,0); putch_lcd('E'); break; 
case 15 : LCD_clear_row(1); goto_xy(0,1); rtc_read_time(); rtc_time_to_lcd(); goto_xy(17,0); putch_lcd('F'); break; 
} 

. 
. 
. 
.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top