- #include "2440addr.h"
- #include
- #include
- #include
- #include
- #include
- #define TXD0READY (1<<2)
- #define RXD0READY (1)
- #define UART_CLK 50000000 // Set the clock source of UART0 to PCLK
- #define UART_BAUD_RATE 115200 // baud rate
- #define UART_BRD ((UART_CLK / (UART_BAUD_RATE * 16)) - 1)
- /*
- * Initialize UART0
- * 115200,8N1,no flow control
- */
- void Uart0_Init(void)
- {
- rGPHCON |= 0xa0; // GPH2, GPH3 are used as TXD0, RXD0
- rGPHUP = 0x0c; // GPH2, GPH3 internal pull-up
- rULCON0 = 0x03; // 8N1 (8 data bits, no parity, 1 stop bit)
- rUCON0 = 0x05; // Query mode, UART clock source is PCLK
- rUFCON0 = 0x00; // Do not use FIFO
- rUMCON0 = 0x00; // Do not use flow control
- rUBRDIV0 = UART_BRD; // baud rate is 115200
- }
- /*
- * Send a character
- */
- void Send_Byte(unsigned char c)
- {
- /* Wait until all data in the send buffer has been sent out */
- while (!(rUTRSTAT0 & TXD0READY));
- /* Write data to the UTXH0 register and the UART will automatically send it out */
- rUTXH0 = c;
- }
- /*
- * Receive characters
- */
- unsigned char Get_Byte(void)
- {
- /* Wait until there is data in the receive buffer */
- while (!(rUTRSTAT0 & RXD0READY));
- /* Directly read the URXH0 register to obtain the received data */
- return rURXH0;
- }
- /*
- * Determine whether a character is a number
- */
- int isDigit(unsigned char c)
- {
- if (c >= '0' && c <= '9')
- return 1;
- else
- return 0;
- }
- /*
- * Determine whether a character is an English letter
- */
- int isLetter(unsigned char c)
- {
- if (c >= 'a' && c <= 'z')
- return 1;
- else if (c >= 'A' && c <= 'Z')
- return 1;
- else
- return 0;
- }
- void Uart0_SendString(char *pt)
- {
- while(*pt)
- {
- Send_Byte(*pt++);
- }
- }
- void Uart_Printf(char *fmt,...)
- {
- va_list ap;
- char string[256];
- va_start(ap,fmt);
- vsprintf(string,fmt,ap);
- Uart0_SendString(string);
- va_end(ap);
- }
Previous article:Remap of STM32
Next article:NANDFlashd reading and writing (based on s3c2440)
Recommended ReadingLatest update time:2024-11-16 23:34
Design of embedded image information acquisition and transmission system
1. Introduction
Home security has been a problem that has troubled people for a long time. The rise of "smart home" can be said to not only solve this problem, but also improve people's quality of life. However, its high cost is unaffordable for most people. This paper proposes a simple, low-cost dedicated home secu
[Microcontroller]
U-boot porting on mini2440-S3C2440 (3) - Phase 1: Exploring the boot code
1. This article takes the mini2440 development board as an example: u-boot is a two-stage Bootloader. The first stage files are CPU/arm920t/start.S and board/mini2440/lowlevel_init.S. The former is platform-related and the latter is development board-related. U-boot first stage code: 1. Hardware device initialization
[Microcontroller]
S3C2440 clock frequency
System clock
Before the clock of MINI2440 development board is turned on, the whole development board relies on a 12MHz crystal oscillator to provide frequency to run, that is to say, CPU, memory, UART and other hardware that need clock frequency all work at 12MHz, while S3C2440A can work normally at 400MHz. Th
[Microcontroller]
S3C2440 timer configuration
The relevant registers for timer configuration are as follows (listed in the order of the s3c2440 manual)
1. TCFG0: Timer Configuration Register 0
Function: Define the dead zone length of the device and set the pre-calibrator value
Description: Bits set the pre-calibrator value for timers 0 and 1, an
[Microcontroller]
Linux 2.6.32 porting to arm9 (s3c2440) platform 2 -- Kconfig and Makefile
I followed countless posts and documents on Ubuntu and spent a lot of time to set up the Qt environment and Eclipse, only to find in the end that these were irrelevant things. The first thing to do was to port Linux to the ARM core board. I fiddled with the porting for a long time and was confused by the complex tre
[Microcontroller]
Description of the address change of s3c2440_write_addr_lp function in S3C2440NAND operation
Source Program static void s3c2440_write_addr_lp(unsigned int addr) { int i; volatile unsigned char *p = (volatile unsigned char *)&s3c2440nand- NFADDR; int col, page; col = addr & NAND_BLOCK_MASK_LP; page = addr / NAND_SECTOR_SIZE_LP; *p = col & 0xff; /* Column Address A0~A7 */ for(i=0; i 10; i++); *p
[Microcontroller]
The startup process of the arm chip using s3c2440 as an example
The startup process of arm embedded chips is actually very complicated for embedded novices. Many people have only a little understanding of it and there are many misunderstandings. In the author's opinion, if you want to truly understand this startup process, you must first understand the differences and connections
[Microcontroller]
Design and implementation of terminal LCD driver circuit based on S3C2440A
introduction
Most of the portable handheld terminal products now, such as mobile phones, navigation systems, etc., have a small LCD display, which makes the design of LCD drive circuit an important part of handheld terminal design.
This article takes handheld terminals used in special industries as an exam
[Microcontroller]
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- 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
MoreDaily News
- 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
Guess you like
- MSP430F249 external interrupt P1.3 port
- Looking for part-time job,
- Cumulative error analysis and clock frequency optimization for UART communication in MSP430FR2311
- Learn 3D visualization from scratch: Exploded diagram
- 1000m WIFI amplifier ~ Anyone interested?
- FilterSolutions User's Guide The simulated filter that has been practiced is pretty good
- What is the definition of these so-called self-organizing networks?
- dsp6657 serial port learning
- Try the data visualization tool of visionseed in Ubuntu
- Help with AD9 package design