- /****************************************************************************
- # * File name: UART0.h
- # * Function: declare related global functions about UART0
- # * Version: 1.0
- # * Author: jianqi2010
- # ****************************************************************************/
- void UART_Init(void);
- void UART_Send_Byte(char ch);
- void UART_Send_String(char* p);
- /****************************************************************************
- # * File name: UART0.c
- # * Function: define global functions related to UART0
- # * Version: 1.0
- # * Author: jianqi2010
- # ****************************************************************************/
- #include"UART0.h"
- #include"config.h"
- #define BAUD 9600 //Baud rate
- void UART_Init(void)
- {
- uint16 Fdiv;
- U0LCR = 0x83; // related check bit, data length, etc., DLAB = 1, baud rate can be set
- Fdiv=(Fpclk/16)/BAUD;
- U0DLM=Fdiv/256;
- U0DLL=Fdiv%256;
- U0LCR=0X03;
- }
- /****************************************************************************
- # * Name: UART_Send_Char
- # * Function: UART0 sends byte function
- # * Entry parameters: bytes waiting to be sent
- # * Export parameters: None
- # ****************************************************************************/
- void UART_Send_Byte(char ch)
- {
- U0THR = ch;
- while((U0LSR&0x40)==0); //Wait for data to be sent
- }
- /****************************************************************************
- # * Name: UART_Send_String
- # * Function: UART0 sends string function
- # * Entry parameter: string to be sent
- # * Export parameters: None
- # ****************************************************************************/
- void UART_Send_String(char* p)
- {
- while (*p!='/0')
- {
- UART_Send_Byte(*p++);
- }
- }
- /****************************************************************************
- # * File name: main.c
- # * Function: Test the sending program of UART0
- # * Version: 1.0
- # * Author: jianqi2010
- # ****************************************************************************/
- #include"config.h"
- #include"UART0.h"
- //Test function
- int main(void)
- {
- BRUSH0=0X05;
- IO0DIR = 0x01;
- UART_Init();
- UART_Send_String("HellowWord");
- return 0;
- }
Previous article:Using ARM external interrupt to control the flashing speed of the water lamp (based on LPC2134)
Next article:Let 2440 output driver debugging information
- 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
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- SG3824 is a push-pull switching power supply without dual PWM output. Can you help me?
- [Sipeed LicheeRV 86 Panel Review] VII. Compiling d1-h_nezha-...
- Optimal control of solar panel position based on GD32E231
- STM32F103C8T6 low power consumption problem
- Counting TI's star products in T-BOX: Automotive Ethernet | Section 1 DP83TC811S-Q1: Automotive Ethernet makes your T-BOX...
- ADAFRUIT PYBADGE LC CAN RUNNING MAKECODE ARCADE, CIRCUITPYTHON AND ARDUINO
- STSPIN32F0 FOC control board drives DJI model aircraft motor/single resistor/schematic diagram/code/debugging instructions and other information are open source
- EEWORLD University Hall----Live Replay: The new Infineon MOSFET based on Source-down technology effectively improves power density, which is visible to the naked eye
- Keil registration machine 2032
- March 19 live broadcast review: Introduction to ST MEMS sensor development kit (including video, presentation documents, Q&A summary)