Hardware Connection:
Code:
#include #define uchar unsigned char #define uint unsigned int sbit k3 = P3^4; sbit k4 = P3^5; uchar code DSY_CODE[]= { 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff }; uchar code Scan_BITs[]= { 0x20,0x10,0x08,0x04,0x02,0x01 }; uchar data Buffer_Counts[]={0,0,0,0,0,0}; uint Count_A=0; uint Count_B=0; void DelayMS(uint x) { flying t; while(x--) { for(t=0;t<120;t++); } } void Show_Counts() { uint i; Buffer_Counts[2] = Count_A / 100; Buffer_Counts[1] = Count_A % 100 /10; Buffer_Counts[0] = Count_A % 10; if(Buffer_Counts[2]==0) { Buffer_Counts[2] = 0x0a; if(Buffer_Counts[1]==0) { Buffer_Counts[1]=0x0a; } } Buffer_Counts[5] = Count_B / 100; Buffer_Counts[4] = Count_B % 100 /10; Buffer_Counts[3] = Count_B % 10; if(Buffer_Counts[5]==0) { Buffer_Counts[5] = 0x0a; if(Buffer_Counts[4]==0) { Buffer_Counts[4]=0x0a; } } for(i=0;i<6;i++) { P2 = Scan_BITs[i]; P1 = DSY_CODE[Buffer_Counts[i]]; DelayMS(1); } } void main() { IT0 = 1; IT1 = 1; PX0 = 1; IE = 0x85; while(1) { if(k3 == 0) Count_A = 0; if(k4 == 0) Count_B = 0; Show_Counts(); } } void EX_INT0() interrupt 0 { Count_A++; } void EX_INT1() interrupt 2 { Count_B++; }
Previous article:TIMERO microcontroller controls water lamp
Next article:Single digital tube displays 4x4 matrix buttons
Recommended ReadingLatest update time:2024-11-23 12:06
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
- 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
- Jfinal实现定时任务调度
- The State of Open Source Hardware in 2021
- Implementation of HPI Boot Mode in TMS320C62x
- What is the physical meaning of Gauss's formula in advanced mathematics?
- Applications of transient voltage suppressors
- 【Portable Environmental Status Detector】Compile and download function test
- Learn about TI 15.4-Stack's support for 470M frequency band
- 【Me and Yatli】+My impression of Yatli
- Advanced Algebra Concise Course
- Master's thesis - Design of fuzzy PID control chip based on FPGA