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
}
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.
Previous article:Serial communication verification main control module debugging program
Next article:Digital clock program
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Power supply fluctuation problem of portable equipment
- RFID antenna connector classification
- EEWORLD University Hall----Live Replay: Metaverse Testing Seminar Series: Challenges of VR/AR Digital Interface Testing
- CCS5 connection debugging C64X series DSP core
- Help! How to convert assembly language into C language? ? ?
- 【MSP430】Capture mode to measure signal duty cycle
- Short-range wireless positioning technology
- In addition to the cost of electronic components, what other costs are there in hardware product development?
- Demonstrate RTOS projects for ARM, DSP and IPU based on Windows system
- Integrated 2x output amplifier circuit, 12Bit four-channel digital-to-analog converter with power-down mode