Keyboard display module debugger

Publisher:清新心情Latest update time:2018-01-10 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere


The flowchart of  keyboard display module debugging  is shown in the figure below:
 #include  
#include  
#define com XBYTE[0X9FFF] ;8279 command entry address 
#define dat XBYTE[0x9eff] ;8279 data entry address

#define uchar unsigned char 
#define uint unsigned int 
sbit cflag=ACC^7; 
uchar j=0,sq; 
uchar code keytab[16]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08, 0x09, 
                       0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; ;Key code table 
uchar code tab[16]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77, 
                    0x7c ,0x39,0x5e,0x79,0x71}; ; glyph table 
void delay(uint t); ; Delay function 
void clr(); ; Clear 8279 RAM data 
void serve(); ; 8279 interrupt service function 

void main (void) ; Main function 
     {uint i; 
      com=0xd1; ; Send clear instruction 
      do{ACC=com;} 
      while(cflag!=0); ;Check the status register DU until DU is zero 
      com=0x34; ;Calibration value 20 
      com=0x10; ;Write 8279 working mode: input from the left end, 8 characters are displayed 
      delay(200); ; Delay 
      com=0x90; ;Write to 8279 display RAM starting unit 0, automatically add 1 
      EA=1; ;Open interrupt 
      EX0=1; 
IT0=1; 
     do{} 
     while(1); ;Wait for key interrupt 
   } 
void serve () interrupt 0 ;interrupt service function 
  { 
       uint i; 
       com=0x40; ;read the key value in FIFO 
       sq=dat&0x3f; ;Retain the key code part 
       for(i=0;i<16;i++) 
           {if(sq==keytab[i]) break; ;Check the key code table 
                 } 
                    dat=tab[i]; ;Check the glyph table and convert the key The value is sent to the display 
  } 
void delay(uint t); delay function 
    {uint i,j; 
      for(i=0;i         for(j=0;j<100;j++); 
    } 
void clr( void); Clear 8279 display RAM data function  
  {com=0xd1; 
   do{ACC=com;} 
     while(cflag!=0); 
     j=0; 
     com=0x90; 
     dat=0x40; 
   } 
During the test, each key is pressed , the digital tube displays the corresponding value, which means the debugging is successful. 


Reference address:Keyboard display module debugger

Previous article:Serial communication verification main control module debugging program
Next article:Digital clock program

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号