. The sent character information can be seen through the serial port debugging assistant. The baud rate is 9600
#include
#include
//--------------------------------
char *name_month(int n);
void Delay(int x);
void put(char str);
void initUart(void);
void putString(unsigned char const *pstr); //const //
--------------------------------
void put(char str)
{
SBUF=str;
while(!TI); TI
=0;
}
//-------------------------------- void initUart
(void)
{
TMOD=0x20
; SCON
=
0x50 ; TH1= 250; TL1 = 250;
TR1 = 1;
EA = 1; ; } //--------------------------------- char *name_month(int n) { static char *name[]= { "Illegal month\n", "January\n", "February\n", "March\n", "April\n", "May\n", "June\n", "July\n", "August\n", "September\n", "October\n", "November\n", "December" mber\n" }; return((n<1||n>12) ? name[0]:name[n]); } //---------------------------------------- void putString(unsigned char const *pstr)//const { while(1) { if(*pstr=='\0') break; put(*pstr++); } } //---------------------------------------- void main(void) { int i; char *s; initUart(); putString("I come here pointer!\n"); for (i=1;i<13;i++) { s=name_month(i); while(1) { if (*s=='\0') break; put(*s++); } Delay(1000); } }
Previous article:Application of ICL7135 serial acquisition mode in single chip microcomputer
Next article:51 MCU ADC0832 voltage measurement LCD 1602 display C program and proteus simulation
- Popular Resources
- Popular amplifiers
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
- mRNA vaccine badge
- Generate compensation ramp
- TI's Ultrasonic Sensing Technology for Flow Measurement
- [Visible] Intangible necessities
- Purgatory Legend-RAM War.pdf
- AD19, making 3D animation, "The 3D Movie Panel is disabled in 2D" How to solve it?
- Guitar Shaped Audio PCB Amplifier
- 26 "Wanli" Raspberry Pi car - program startup
- Among the working modes of switching power supplies, which switching mode is both economical and affordable?
- Simple example of DSP interrupt configuration