The following is the C language source program:
#include #define uint unsigned int #define uchar unsigned char uintled[]={0xc0,0xf9,0xa4, 0xb0,0x99,0x92,0x82,0xf8,0x80,0x90, 0x88,0x83,0xc6,0xa1,0x86,0x8e}; uchar a,b,c,temp; void delay7ms(void) //error -0.217013888891us { unsigned char a,b; for(b=208;b>0;b--) for(a=14;a>0;a--); } ucharkey() { P1=0x0f; if(P1!=0x0f) { delay7ms(); if(P1!=0x0f); P1=0xfe; a=P1^0xfe; switch(a) { case 0x80:c=0;break; case 0x40:c=1;break; case 0x20:c=2;break; case 0x10:c=3;break; } temp=P1; while(temp!=0xfe) { temp=P1; } } P1=0x0f; if(P1!=0x0f) { delay7ms(); if(P1!=0x0f); P1=0xfd; a=P1^0xfd; switch(a) { case 0x80:c=4;break; case 0x40:c=5;break; case 0x20:c=6;break; case 0x10:c=7;break; } temp=P1; while(temp!=0xfd) { temp=P1; } } P1=0x0f; if(P1!=0x0f) { delay7ms(); if(P1!=0x0f); P1=0xfb; a=P1^0xfb; switch(a) { case 0x80:c=8;break; case 0x40:c=9;break; case 0x20:c=10;break; case 0x10:c=11;break; } temp=P1; while(temp!=0xfb) { temp=P1; } } P1=0x0f; if(P1!=0x0f) { delay7ms(); if(P1!=0x0f); P1=0xf7; a=P1^0xf7; switch(a) { case 0x80:c=12;break; case 0x40:c=13;break; case 0x20:c=14;break; case 0x10:c=15;break; } temp=P1; while(temp!=0xf7) { temp=P1; } } return c; } void main(void) { while(1) { P2=led[b]; b=key(); } }
Previous article:89C51 programmer end driver example
Next article:MCU Low Power Design Experience
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Precautions for using DS1820
- You guys don't share the comparison pictures of software and hardware engineers. Let's talk about it.
- Hejian Gongsoft's New Year's greetings for 2022 - Spring brings blessings and everything is glorious
- How high can the transmission power of 5G mobile phones be?
- Wireless communication development trend part 1
- ESP32 uses littlefs v2 as the default file system
- Application of three-phase SPWM generator SA8282 in static inverter
- [2022 Digi-Key Innovation Design Competition] Unboxing of materials STM32F7508DK and WE inductors and other accessories
- Embedded Software Engineer Interview Experience Sharing
- EEWORLD University ---- TI Type C solution for mobile devices