Looking at the materials in the drawer, I wanted to make something for fun. I originally wanted to make a 99-meter meter, but there were not enough key switches, so I changed it to a clock. Without further ado, here are the pictures. The final simulation schematic diagram
of the minimum system
display module is as follows (the proteus simulation project file can be downloaded in the attachment of this post) The microcontroller source program is as follows:
/*********************************************************************************
*Experiment name: Digital tube dynamic display
*Experimental results: 8-bit digital tube displays the numbers 12345678
*Note: The delay time between each digital tube display is less than 3ms, and you can see 8 digital tubes light up at the same time
*
*********************************************************************************/
#include #define uchar unsigned char #define uint unsigned int uint k=0; uint second=0;//second uint min = 0; // Minutes uint hour=1;//hour sbit we1=P3^3; //bit selection sbit we2=P3^1; sbit we3=P3^2; sbit we4=P3^0; sbit L0=P2^0; uchar code sz[17]={0x3f , 0x06 , 0x5b ,0x4f , 0x66 , 0x6d ,0x7d , 0x07 , 0x7f , 0x6f ,0x77 , 0x7c , 0x39 , 0x5e , 0x79 , 0x71 , 0x00}; //0-9&A-F&“not displayed” font code void delay(uint xms) //xms equals to the delay of a few milliseconds { uint i,j; for(i=xms;i>0;i--) for(j=112;j>0;j--); } void Init_timer0(void) { TMOD |= 0X01; //Working mode 1 Timing function controlled by internal register TH0=0X3c; //initial value of the upper eight bits TL0=0Xb0; //initial value of the eighth bit EA=1; // Enable overall interruption ET0=1; //Enable timer 0 interrupt TR0=1; //Start counting } void Timer0_isr(void)interrupt 1 { TH0=0x3c; TL0=0xb0; k++; } void main() { Init_timer0(); while(1) { if(k==20) //20 times 1 second { second++; k=0; if(second==60) { second =0; min++; if(min==60) { min=0; hour++; if(hour==13) { hour=1; } } } } P1=sz[min%10]; //Minute display we4 =0; delay(5); we4=1; P1=sz[min/10]; of 3=0; delay(5); of 3=1; P1=sz[hour%10]; //Hour display we2=0; delay(5); we2=1; P1=sz[hour/10]; we1=0; delay(5); we1=1; /*P1=sz[0]; //display 0 we1=0; delay(10); we1=1; P1=sz[1]; //display 1 we2=0; delay(10); we2=1; P1=sz[2]; //display 2 of 3=0; delay(10); of 3=1; P1=sz[3]; //display 3 we4=0; delay(10); we4=1;*/ } } …………………
Previous article:MFRC522 circuit schematic and MCU test program
Next article:GP2Y0E02B distance measurement module 89c52 microcontroller serial port 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
- 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
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Why does the power consumption of stm32L0 increase after it enters STOP mode again after being woken up by an external interrupt in STOP mode?
- [TI millimeter wave radar evaluation]_4_boost board evaluation encountered problems 2
- Using registers to do STM8 UART1 error request help
- BearPi-HM Nano Development Board Review 0 Unboxing and Development Environment Setup
- Let's discuss how many people you think should be invited.
- Qinheng CH37X series interface chip application reference example
- I found another DK IOT STUDIO online IDE that runs RAPID IOT. I guess they are the same but distributed on different websites.
- ECG-based heart rate monitoring using the LaunchPad Value Line development kit for the MSP430G2452 microcontroller
- [GD32L233C-START Review] - VII. SPI mode driving 1.5-inch OLED screen
- My creative plan and functional implementation plan