TQ2440 serial port data transmission

Publisher:创意火舞Latest update time:2016-04-22 Source: eefocusKeywords:TQ2440 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Serial port printing, this is a good thing. The goal is to print the data transmitted from the board on the hyperterminal, that is, the data transmitted by the board can be displayed on the computer. This is relatively easy. I referred to the 2440lib.c file that comes with TQ. After initializing those reference chips and that c file, the program came out quickly. There are easier methods, but it is more impressive to write it yourself.
The procedure is as follows:
#include "2440addr.h"
#include "Option.h"
#include "def.h"
//Why doesn't it work once U32 is used?
unsigned int PCLK;
extern void Uart_Printf(char *fmt,...); //Function declaration, otherwise a warning will be displayed
extern void Uart_Select(int ch);
 
void delay(void) // Delay() is defined in 2440lib.c, but I accidentally redefined it. I was confused for a while
{
unsigned int i,j;
for(i=0;i<1000;i++)
for(j=0;j<1000;j++)
;
}
 
void My_uart_init(int mypclk,int mybuat) //Serial port initialization written by myself
{
unsigned int a;
rGPHCON = 0x0faaa; //0x1111 1010 1010 1010 select RTS, CTS, TXD, RXD
rGPHUP = 0x7ff; //Cancel all pull-up resistors [0; 10] A total of 11 I/O ports
if(mypclk == 0) //If it is 0, use the PCLK clock frequency in mpll. Here I used 50MHz, and it must be 50MHz
mypclk = PCLK; //Isn't the PCLK of mpll 50MHz? If you set mypclk to 0, it should be OK, but I haven't tried it.
 
rUFCON0 = 0x0;
rUFCON1 = 0x0;
rUFCON2 = 0x0; //FIFO disabled
rUMCON0 = 0x0;
rUMCON1 = 0x0; //Disable AFC, etc.
rULCON0 = 0x3; //Transmission word length 8 bytes
rUCON0 = 0x245; // [0,3] is reserved and cannot be set. Set Rx error status interrupt and Tx level interrupt. The settings of serial ports 1 and 2 are the same
rUBRDIV0 = ((int)(mypclk/(mybuat*16)))-1; // Provide serial clock for transmitter and receiver, see chip manual for calculation formula
rULCON1 = 0x3;
rUCON1 = 0x245;
rUBRDIV1 = ((int)(mypclk/(mybuat*16)))-1;
rULCON2 = 0x3;
rUCON2 = 0x245;
rUBRDIV2 = ((int)(mypclk/(mybuat*16)))-1;
for(a=0;a<100;a++);//delay, refer to 2440lib.c, my personal understanding should be
}
 
void Main(void)
{
Uart_Select(0); //Select serial port 0
My_uart_init(50000000,115200); // Give the clock 50MHz, baud rate 115200 serial port to work
Uart_Printf("\n\n"); //Test whether the input \n in 2440lib.c will be supplemented with \r, carriage return and line feed
delay();
while(1)
{
Uart_Printf("I love caimanjun more than myself\n"); //Print string
delay();
Uart_Printf("yes I do! \n");
delay();
}
}
 
 
Keywords:TQ2440 Reference address:TQ2440 serial port data transmission

Previous article:TQ2440 key interrupt
Next article:TQ2440's simplest serial port data transmission

Recommended ReadingLatest update time:2024-11-16 14:41

TQ2440 linux i2c driver - at24c02 (eeprom)
1. Development environment: (1) Development board: TQ2440 development board (2) PC system: Ubuntu 13.04-amd64 (3) Interleaved compiler: arm-linux-gcc version-4.3.3 (4)linux kernel:linux 2.6.30。4 2. Introduction to the i2c system (Here are some words about the structure, taken from the Internet) I2C is a peripheral b
[Microcontroller]
TQ2440 linux i2c driver - at24c02 (eeprom)
Research on Touch Screen Driver Based on TQ2440 and Linux
Embedded technology is becoming more and more popular in industry and daily life. As an interactive terminal, touch screens have gradually replaced keyboards as input devices for embedded systems. Using the TQ2440 development board, we studied the touch screen driver in the embedded Linux kernel, wrote and transplan
[Microcontroller]
Research on Touch Screen Driver Based on TQ2440 and Linux
u-boot-1.1.6 transplantation based on TQ2440 (basic steps)
References: "Transplanting u-boot-1.1.6 to TQ2440 Documentation" Tianqian transplanted source code Migration environment System: Ubuntu 12.04 built by Huaqing Yuanjian virtual machine Development board: TQ2440 Cross compiler: crosstools_3.4.5_softfloat CPU:S3C2440 SDRAM: 64M NOR Flash:2M NAND Flsah:256M NET:DM9000
[Microcontroller]
u-boot-1.1.6 transplantation based on TQ2440 (basic steps)
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号