Use the timer/counter T0 to output a square wave with a period of 1s from P1.0
to make the light-emitting diode flash at 1HZ.
#include
#include
#define uint unsigned int
#define uchar unsigned char
sbit P1_0=P1^0;
uchar tt;
void main()
{
}
void timer0() interrupt 1
{
}
Procedure 2
Use timer/counter T1 to generate a timing clock, and
control 8 light-emitting diodes through P1 port,
so that the 8 indicator lights flash one by one in turn, with
a flashing frequency of 10 times/second (8 lights light up in turn for one cycle), in a cycle.
#include
#include
#define uint unsigned int
#define uchar unsigned char
sbit P1_0=P1^0;
uchar tt,a;
void main()
{
}
void timer0() interrupt 1
{
}
Procedure 3
the same frequency. The square waves of
1, 10, 50, 100, 200, 400, 800, and
1k (hz) are output in turn at intervals of 2s.
#include
#include
#define uint unsigned int
#define uchar unsigned char
sbit beep=P2^3;
uchar tt;
uint fre,flag;
void main()
{
}[page]
void timer0() interrupt 1
{
}
void timer1() interrupt 3
{
}
Procedure 4
Use a timer to display 0, 1, 2, 3...C, D, E, F on the 6-digit digital tube in sequence at intervals of 500MS, and repeat.
#include
#include
#define uint unsigned int
#define uchar unsigned char
sbit dula=P2^6;
sbit wela=P2^7;
uchar num,tt;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
void main()
{
}
void exter0() interrupt 1
{
}
Previous article:51 MCU C language program (III) Digital tube
Next article:Notes on making the minimum system of 51 single-chip microcomputer
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Circuit
- TMS320F28035 call jump instruction problem
- Sliding resistor for LM358 comparator
- TE pressure sensor: underwater robots from 0 to 1000, how to avoid mass production pitfalls
- OHM Graphical Introduction to Electronics
- Detailed explanation of the design of RFID-based smart hotel system
- 【Qinheng Trial】Streamlined mobile phone system design #1
- A newbie asks a question about the STC15 interrupt function
- MSP432P401R LaunchPad download program prompts not supported
- Help 40E Gold