#include
#define uchar unsigned char
float rtemp,sflag;
void SerialInit() //11.0592M crystal oscillator, baud rate 9600
{
TMOD=0x20; //Set timer 1 to work in mode 2
TH1=0xfd;
TL1=0xfd;
TR1=1; //Start timer 1
SM0=0; //Serial port mode 1
SM1=1;
REN=1; //Allow receiving
PCON=0x00; //Close the frequency multiplier
ES=1; //Open serial port interrupt
EA=1; //Open the general interrupt
}
void SerialService() interrupt 4
{
if(RI==1)
{
RI=0;
rtemp=SBUF; //Read buffer
sflag=1;
}
}
void main()
{
SerialInit();
while(1)
{
if(sflag==1)
{
ES=0; //Disable serial port interrupt during sending
sflag=0;
SBUF=rtemp;
while(!IF);
IF = 0;
ES=1; //Open serial port interrupt after sending completed
}
}
}
Previous article:51 single chip microcomputer (AT89C52) controls dual relays
Next article:51 single chip microcomputer (AT89C52) D/A conversion
Recommended ReadingLatest update time:2024-11-17 00:00
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
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
- [Raspberry Pi Pico Review] MicroPython Development Environment Setup
- Vivado Getting Started and Improved (High Runner-up)
- MicroPython Hands-on (38) - Controlling the Touch Screen
- Use serial port tools and serial port assistants to monitor the communication process between the mainboard MCU and the Bluetooth module--
- [SAMR21 New Gameplay] 20. Analog Input and Analog Output
- The meaning of some letters in transistor models
- [RVB2601 development board trial experience] GPIO output test
- Experience in debugging Ethernet half-duplex of GD32F450
- Don't know UWB? Then take a look at these knowledge posts shared by netizens to quickly understand ultra-wideband UWB
- There should be a simpler way to convert a sine wave into a triangle wave. If you have ever used a triangle wave, please share your experience...