Today I got a few simple programs for the microcontroller:
Delay program:
void Delay(unsigned int xx) //Input xx: ms
{
while(xx--)
{
Delay1ms();
}
}
void Delay1ms() //@11.0592MHz 1ms
{
unsigned char i, j;
_nop_();
_nop_();
_nop_();
i = 11;
j = 190;
do
{
while (--j);
} while (--i);
}
Flowing lights program:
#include
int main()
{
p1 = 0xfe;
while(1)
{
p1 = _crol_(p1, 1);
Delay(500);
}
return 0;
}
Buzzer program:
void BEEP_ON() //Buzzer on, duration: 500ms,
{
sbit beep = p2 ^ 3;
beep = 0; //Buzzer on
Delay(500); //Delay
beep = 1; //Buzzer off
}
Previous article:Microcontroller Study Notes (I)
Next article:51 Development Environment Construction--KeilC51 Installation and Project Creation
Recommended ReadingLatest update time:2024-11-22 21:53
- 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
- Stack Overflow Technology from Entry to Mastery
- pic10F322 demo board 02 Features
- Please answer my question: What is the role of capacitor in this synchronous buck circuit?
- RT-Thread's new book is here, full of useful information
- 【Resistors】How to quickly read the color ring? Calculate the resistance value?
- MSP432 Serial Port Settings
- Practice together in 2021 + tomorrow will be better
- TMS320C66x dual loop and multiple loop optimization summary
- Can anyone share the third-party extension library of mixly?
- 【Perf-V Evaluation】Chip Temperature Collection