The following is the circuit diagram of the digital tube part: The following is the circuit diagram of the matrix keyboard part: The C51 microcontroller program is as follows:
#include
#define uchar unsigned char
#define uint unsigned int
//Segment code of digital tube
uchar table[16] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
fly seg[4]={0xfe,0xfd,0xfb,0xf7};
this is flying;
void Delay_1ms(uint i) //1ms delay
{
fly x,j;
for(j=0;j
Reference address:51 MCU matrix button circuit diagram + program
for(x=0;x<=148;x++);
}
void keyboard()
{
fly x,y,i;
for(y=0;y<4;y++)
{
P1=seg[y];
if((P1&0xf0)!=0xf0)
{
Delay_1ms(5);
if((P1&0xf0)!=0xf0)
{
x=P1&0XF0;
x=(x>>4)|0xf0;
for(i=0;i<4;i++)
{
if(x==seg[i])
{
x=i;
shu=4*y+x+1;
}
}
}
}
}
}
void segdisplay(float i)
{
P0 = 0; //Blanking
P2 = 6; //The 7th digital tube display
P0 = table[(i / 10)%10]; //Get the tens digit of i here
Delay_1ms(5); //Display the next number after 0.5 seconds delay
P0 = 0; //Blank
P2 = 7; //The 8th digital tube display
P0 = table[i % 10]; //Get the unit digit of i here
Delay_1ms(5);
P0=0;
}
void main()
{
this = 0;
while(1)
{
keyboard();
segdisplay(shu);
}
}
Previous article:Design of image-based electronic police system based on single chip microcomputer
Next article:Single chip microcomputer timer T0 counts seconds C51 program + circuit
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- 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)
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- 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?
Guess you like
- [GD32L233C-START Review] 3. GPIO, EXTI
- Help e-book: Electrical control circuit: basics, control devices, diagram reading, wiring and debugging, edited by Han Xuetao
- [Xianji HPM6750 Review 6] A UVC-like camera with CDC transmission display
- orcad to altium
- [Solved] STM32 open-drain output and pull-up input detection button
- TI High Voltage Motor Control and PFC Developer's Kit
- Domestic chips recommend Unisplendour chips
- EEWORLD University ---- HCIA-IoT Huawei Certified Internet of Things Engineer Video Course
- Pingtouge RVB2601 board-NETMGR and WIFI
- Fresh and hot GD32L233C-START development board information