#include
unsigned int t02s;
bit flag;
sbit P1_5=P1^5;
void main(void)
{
TMOD=0x01;
TH0=(65536-500)/256;
TL0=(65536-500)%6;
TR0=1;
ET0=1;
EA=1;
while(1);
}
void t0(void) interrupt 1 using 0//0.5MS timer interrupt subroutine
{
TH0=(65536-500)/256;
TL0=(65536-500)%6;
t02s++;
if(t02s==400)//200MS timing
{
t02s=0;
flag=~flag;
}
if(flag==0)
P1_5=~P1_5;
}
Previous article:DS1302 read and write program (IIC bus)
Next article:8255 single control stepper motor
Recommended ReadingLatest update time:2024-11-16 16:26
STM32 timer realizes PWM output control of passive buzzer (HAL)
1. PWM concept and principle Pulse Width Modulation (PWM), short for "Pulse Width Modulation", is a very effective technology that uses the digital output of a microprocessor to control analog circuits. PWM principle diagram The figure above is a simple PWM principle diagram. In the figure, we assume that the t
[Microcontroller]
ARM4412 bare board drives LED lights, buttons, and buzzers
First find the circuit diagram of the board, taking LED as an example Next is the circuit's network label: Find the register description in the corresponding chip manual The LED light is operated by operating the corresponding register: First, register the corresponding register address into a file: reg.h 1
[Microcontroller]
Learning MCU from Scratch (VIII) Buzzer Singing
The structure of the buzzer on
the microcontroller is very simple
As long as you give it a 0, it will "call". The principle of making it sing is very simple. The volume of the sound is fixed. By changing its frequency, it can make it produce different notes.
In the code, during the software loop delay process, a
[Microcontroller]
51 MCU button control buzzer start and stop program
51 MCU button control buzzer start and stop program #include reg52.h #define uint unsigned int //macro definition sbit SPK=P3^5; //define speaker port sbit key=P3^1; //The corresponding key on the development board is s18 void delay(uint z) { uint x,y; for(x=z;x 0;x--) for(y=110;y 0;y--); } void main() { while(1)
[Microcontroller]
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Principles and Applications of Single Chip Microcomputers and C51 Programming (3rd Edition) (Xie Weicheng, Yang Jiaguo)
- Teach you to learn 51 single chip microcomputer-C language version (Second Edition) (Song Xuefeng)
- Hand-drawn illustrations revealing the secrets of communication circuits and sensor circuits (Mims III)
Latest Microcontroller Articles
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
- 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
MoreDaily News
- 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
Guess you like
- A power backup solution for NVR/DVR systems
- Is there any solution to adjust the voltage accurately to 0.1V and start continuously and stably? ??? ? Help! ! ! !
- Introduction to oscilloscope related terms (Part 2)
- Electric curtain chip solution-single chip solution
- TMS320C5402 serial port initialization
- Some new changes that 5G brings to PA
- 【GD32E231 DIY】OLED usage (SPI)
- Let you know about brushless DC motor
- EETalk: What pitfalls have you encountered during PCB design?
- Harbin Institute of Technology and Harbin Engineering University are banned from using genuine MATLAB software. What do you think about this?