void main()
{
SCON = 0x50; //Mode 1 (SM0 SM1:0 1) serial port 10-bit universal asynchronous interface. Sending or receiving a frame of data information is 10 bits, including 1 start bit "0", 8 data bits, and 1 stop bit "1".
TMOD=0X20; //Set the timer working mode 2 and load the value to start
TH1=0XFD;
TL1=0XFD;
TR1=1;
EA=1; //Turn on the general interrupt
ES=1; //Turn on the serial port interrupt
//while(1);
}
void write() interrupt 4
{
if(RI==1)// Sending end flag
{
RI=0; //Reset to 0 for next sending
P0=SBUF; //Send to P0 port
}
else
TI=1;
}
Previous article:Comprehensive use of C language for, while, if-else, return statements
Next article:Serial communication between microcontroller and host computer
Recommended ReadingLatest update time:2024-11-16 03:30
- 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)
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
- 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
- FAQ_Using any GPIO to simulate a serial port
- MM32F103 Development Board Evaluation: Driving OLED Display
- TMS320C6711 serial communication initialization program
- How should I choose PCB surface treatment? How should I choose between HASL and OSP?
- Why does the digital tube only display 0 and the buttons don't respond?
- Please follow me-DIY smart home system
- Playing with Circuits (1) - High-Side Current Detection
- 【Live FAQ】OMRON relay, switch and connector solutions for photovoltaic inverters/energy storage systems
- In the era of autonomous vehicles: Antenna measurement and simulation are more critical than ever
- 3 Benefits of Using Low IQ Buck/Boost Converters to Extend Flow Meter Battery Life