ekstern avbryte hjelp av tastaturet encoder 74c922

D

denesio

Guest
her er en kode:

Code:.

.

.

.

.

.

const char key_table [16] = "123A456B789C * 0 # D";

unsigned char key;

/ / unsigned char ex0_isr_counter = 0;void ex0_isr (void) avbryte 0

(

/ / ex0_isr_counter / / increment telling

unsigned char keypad_scan;

key = ((keypad_scan = keypad_address) & keypad_mask);

nøkkel = key_table [viktige];

goto_xy (0,0);

putch_lcd (key);

)

.

.

.

.

.

.

.

mens 1 ()

(

.

.

.

.

if (nøkkel == 4)

(

goto_xy (2,0);

putch_lcd (0xe4);

Plasserer (VSE-VSE ");

)

.

.

.

.

)

 
som mikrokontroller er du bruker.Se min kode for AVR mikrokontroller
http://booksbybibin.14.forumer.com/viewtopic.php?t=11

Bibin John
www.bibinjohn.tk

 
Jeg bruker 89c51rd2 ..
det fungerer nå ...
Code:# define keypad_mask 0x0F

# define keypad_address (* ((unsigned char xdata *) 0x8007))

.

.

.

const char koden key_table [16] = "123A456B789C * 0 # D";

unsigned char key;

unsigned char key_lcd;

.

.

.

void ex0_isr (void) avbryte 0

(

unsigned char keypad_scan;

key = ((keypad_scan = keypad_address) & keypad_mask);

key_lcd = key_table [viktige];

goto_xy (19,0);

putch_lcd (key_lcd);

)

.

.

.

.

.

switch (key)

(

/ / Goto_xy (1,1);

case 0: LCD_clear_row (1); goto_xy (0,1); Plasserer (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;

sak 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;

).

.

.

.
 

Welcome to EDABoard.com

Sponsor

Back
Top