Microcontroller Kits
Programmer and Target 89s51
Simple Mikrokontroller 89s51 Trainer
Standart
Mikrokontroller 89s51 Trainer
Super Mikrokontroller Trainer 89s51
All Item Include
ย
Interfacing Keyboard to Microcontroller 8051
ย
Figure 2. Interafacing Connection Keyboard and Microcontroller
ย
( Download File asm : keyboard.zip , Download Circuit: Keyboard.zip
dispclr equ 00000001bfuncset equ 00111000bentrmod equ 00000110bdispon equ 00001100bKbdData bit P3.3KbdClock bit INT0;P3.2DataKeyboard equ 30h; org 0h nopcall init_LCD;Forever: JB KbdClock,$ call GetDataKeyboard jnc Forever acall LCD_Out clr C sjmp Forever;;==================================;Subroutine Get Data From Keyboard;================================== GetDataKeyboard: call Get_scancode cjne a,#0F0h,kybd_pressed JB KbdClock,$ call Get_Scancode Setb C call Convert_Scancode ret;Kybd_pressed: Clr C ret;;===============================;Subroutine Convert Scan Data;Using Look Up Table;===============================Convert_ScanCode: Mov DPTR,#TableKeyboard movc A,@A+DPTR mov DataKeyboard,A ret;LCD_Out: mov R7, #80h acall write_inst mov R7,DataKeyboard acall write_data ret;init_lcd: mov R7,#dispclr acall write_inst mov R7,#funcset acall write_inst mov R7,#dispon acall write_inst mov R7,#entrmod acall write_inst ret;Get_scanCode: clr A Jnb KbdClock,$ mov R0,#08hGet_ScanCode2: Jb KbdClock,$ Mov C,KbdData Rr A mov acc.7,C Jnb KbdClock,$ Djnz R0,Get_ScanCode2 Jb KbdClock,$ Jnb KbdClock,$ Jb KbdClock,$ Jnb KbdClock,$ ret;Write_inst: Clr P3.6 ; RS = 0, Mov P0,R7 ; D7 s/d D0 = P0 = R1 Setb P3.7 ; EN = 1 call delay; call delay time Clr P3.7 ; EN = 0 ret;Write_data: Setb P3.6 ; RS = 1, Mov P0,R7 ; D7 s/d D0 = P0 = R1 Setb P3.7 ; EN = 1 call delay; call delay time Clr p3.7 ; EN = 0 ret;delay: mov R5,#0 delay1:mov R4,#02fh djnz R4,$ djnz R5,delay1 ret;TableKeyboard:DB 00DB 0F9HDB 00DB 0F5H,0F3H,0F1H,0F2H,0FCHDB 00HDB 0FAH,0F8H,0F6H,0F4HDB 0C0HDB '~'DB 00HDB 00HDB 0C1HDB 0C2HDB 00HDB 0C3HDB 'Q1'DB 00H,00H,00HDB 'ZSAW2'DB 00H,00HDB 'CXDE43'DB 00H,00HDB ' VFTR5'DB 00H,00HDB 'NBHGY6'DB 00H,00H,00HDB 'MJU78'DB 00H,00HDB ',KIO09'DB 00H,00HDB './L;P-'DB 00H,00H,00HDB 27HDB 00HDB '[='DB 00H,00HDB 0C5HDB 0C6HDB 0AHDB ']'DB 00HDB ''DB 00H,00H,00H,00H,00H,00H,00H,00HDB 08HDB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00H,00HDB 00H,00HDB 0DHDB 00HDB 0FBHDB 00H,00H,00H,00H,00H,00H,00H,00H,00H,00HDB 0F7Hend
ย
Comments, questions and discussion about this topic
ย
ย