关于mini2440与pc 串口通信的问题
//====================================================================
// File Name : Adc.c
// Function : S3C2410 ADC Test
// Program : Kang, Weon Tark
// Date : May 22, 2002
// Version : 0.0
// History
// 0.0 : Programming start (March 29,2002) -> KWT
// ADC Test -> May 15, 2002 SOP
//====================================================================
#include <stdlib.h>
#include <string.h>
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
#include "def.h"
#include "option.h"
#include "mmu.h"
#include "profile.h"
#include "memtest.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
//***************************[ UART ]******************************
static int whichUart=0;
void Uart_Init(int pclk,int baud)
{
int i;
if(pclk == 0)
pclk = PCLK;
rUFCON0 = 0x0; //UART channel 0 FIFO control register, FIFO disable
rUFCON1 = 0x0; //UART channel 1 FIFO control register, FIFO disable
rUFCON2 = 0x0; //UART channel 2 FIFO control register, FIFO disable
rUMCON0 = 0x0; //UART chaneel 0 MODEM control register, AFC disable
rUMCON1 = 0x0; //UART chaneel 1 MODEM control register, AFC disable
//UART0
rULCON0 = 0x3; //Line control register : Normal,No parity,1 stop,8 bits
// [10] [9] [8] [7] [6] [5] [4] [3:2] [1:0]
// Clock Sel, Tx Int, Rx Int, Rx Time Out, Rx err, Loop-back, Send break, Transmit Mode, Receive Mode
// 0 1 0 , 0 1 0 0 , 01 01
// PCLK Level Pulse Disable Generate Normal Normal Interrupt or Polling
rUCON0 = 0x245; // Control register
rUBRDIV0=( (int)(pclk/16./baud+0.5) -1 ); //Baud rate divisior register 0
//UART1
rULCON1 = 0x3;
rUCON1 = 0x245;
rUBRDIV1=( (int)(pclk/16./baud+0.5) -1 );
//UART2
rULCON2 = 0x3;
rUCON2 = 0x245;
rUBRDIV2=( (int)(pclk/16./baud+0.5) -1 );
for(i=0;i<100;i++);
}
//===================================================================
void Uart_Select(int ch)
{
whichUart = ch;
}
//===================================================================
void Uart_TxEmpty(int ch)
{
if(ch==0)
while(!(rUTRSTAT0 & 0x4)); //Wait until tx shifter is empty.
else if(ch==1)
while(!(rUTRSTAT1 & 0x4)); //Wait until tx shifter is empty.
else if(ch==2)
while(!(rUTRSTAT2 & 0x4)); //Wait until tx shifter is empty.
}
//=====================================================================
void Uart_SendByte(int data)
{
if(whichUart==0)
{
if(data=='\n')
{
while(!(rUTRSTAT0 & 0x2));
// Delay(1); //because the slow response of hyper_terminal
WrUTXH0('\r');
}
while(!(rUTRSTAT0 & 0x2)); //Wait until THR is empty.
// Delay(1);
WrUTXH0(data);
}
else if(whichUart==1)
{
if(data=='\n')
{
while(!(rUTRSTAT1 & 0x2));
//Delay(1); //because the slow response of hyper_terminal
rUTXH1 = '\r';
}
while(!(rUTRSTAT1 & 0x2)); //Wait until THR is empty.
//Delay(1);
rUTXH1 = data;
}
else if(whichUart==2)
{
if(data=='\n')
{
while(!(rUTRSTAT2 & 0x2));
//Delay(1); //because the slow response of hyper_terminal
rUTXH2 = '\r';
}
while(!(rUTRSTAT2 & 0x2)); //Wait until THR is empty.
//Delay(1);
rUTXH2 = data;
}
}
void Main(void)
{
//#########################################################################
int i;
U8 key;
U32 mpll_val=0;
key = 14;
mpll_val = (92<<12)|(1<<4)|(1);
Port_Init();
ChangeMPllValue((mpll_val>>12)&0xff, (mpll_val>>4)&0x3f, mpll_val&3);
ChangeClockDivider(key, 12);
MMU_DisableICache();
MMU_DisableDCache();
//rGPBCON = 0x155555;
Uart_Init( 0,115200 );
Uart_Select( 0 );
//##########################################################################
while(1)
{
//rGPBDAT =0x7fe;
Delay(1000) ;
//rGPBDAT =0x001;
Delay(1000) ;
Uart_SendByte('g');
//Uart_Printf("SBC2440 Test Program VER1.0\n");
}
//Uart_Init( 0,115200 );
//Uart_Select( 0 );
//Uart_Printf("SBC2440 Test Program VER1.0\n");
}
以上是 我在文档上面扣出来的程序 但是 就是不能在终端上面打印字符
希望各位多多帮忙
// File Name : Adc.c
// Function : S3C2410 ADC Test
// Program : Kang, Weon Tark
// Date : May 22, 2002
// Version : 0.0
// History
// 0.0 : Programming start (March 29,2002) -> KWT
// ADC Test -> May 15, 2002 SOP
//====================================================================
#include <stdlib.h>
#include <string.h>
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
#include "def.h"
#include "option.h"
#include "mmu.h"
#include "profile.h"
#include "memtest.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
//***************************[ UART ]******************************
static int whichUart=0;
void Uart_Init(int pclk,int baud)
{
int i;
if(pclk == 0)
pclk = PCLK;
rUFCON0 = 0x0; //UART channel 0 FIFO control register, FIFO disable
rUFCON1 = 0x0; //UART channel 1 FIFO control register, FIFO disable
rUFCON2 = 0x0; //UART channel 2 FIFO control register, FIFO disable
rUMCON0 = 0x0; //UART chaneel 0 MODEM control register, AFC disable
rUMCON1 = 0x0; //UART chaneel 1 MODEM control register, AFC disable
//UART0
rULCON0 = 0x3; //Line control register : Normal,No parity,1 stop,8 bits
// [10] [9] [8] [7] [6] [5] [4] [3:2] [1:0]
// Clock Sel, Tx Int, Rx Int, Rx Time Out, Rx err, Loop-back, Send break, Transmit Mode, Receive Mode
// 0 1 0 , 0 1 0 0 , 01 01
// PCLK Level Pulse Disable Generate Normal Normal Interrupt or Polling
rUCON0 = 0x245; // Control register
rUBRDIV0=( (int)(pclk/16./baud+0.5) -1 ); //Baud rate divisior register 0
//UART1
rULCON1 = 0x3;
rUCON1 = 0x245;
rUBRDIV1=( (int)(pclk/16./baud+0.5) -1 );
//UART2
rULCON2 = 0x3;
rUCON2 = 0x245;
rUBRDIV2=( (int)(pclk/16./baud+0.5) -1 );
for(i=0;i<100;i++);
}
//===================================================================
void Uart_Select(int ch)
{
whichUart = ch;
}
//===================================================================
void Uart_TxEmpty(int ch)
{
if(ch==0)
while(!(rUTRSTAT0 & 0x4)); //Wait until tx shifter is empty.
else if(ch==1)
while(!(rUTRSTAT1 & 0x4)); //Wait until tx shifter is empty.
else if(ch==2)
while(!(rUTRSTAT2 & 0x4)); //Wait until tx shifter is empty.
}
//=====================================================================
void Uart_SendByte(int data)
{
if(whichUart==0)
{
if(data=='\n')
{
while(!(rUTRSTAT0 & 0x2));
// Delay(1); //because the slow response of hyper_terminal
WrUTXH0('\r');
}
while(!(rUTRSTAT0 & 0x2)); //Wait until THR is empty.
// Delay(1);
WrUTXH0(data);
}
else if(whichUart==1)
{
if(data=='\n')
{
while(!(rUTRSTAT1 & 0x2));
//Delay(1); //because the slow response of hyper_terminal
rUTXH1 = '\r';
}
while(!(rUTRSTAT1 & 0x2)); //Wait until THR is empty.
//Delay(1);
rUTXH1 = data;
}
else if(whichUart==2)
{
if(data=='\n')
{
while(!(rUTRSTAT2 & 0x2));
//Delay(1); //because the slow response of hyper_terminal
rUTXH2 = '\r';
}
while(!(rUTRSTAT2 & 0x2)); //Wait until THR is empty.
//Delay(1);
rUTXH2 = data;
}
}
void Main(void)
{
//#########################################################################
int i;
U8 key;
U32 mpll_val=0;
key = 14;
mpll_val = (92<<12)|(1<<4)|(1);
Port_Init();
ChangeMPllValue((mpll_val>>12)&0xff, (mpll_val>>4)&0x3f, mpll_val&3);
ChangeClockDivider(key, 12);
MMU_DisableICache();
MMU_DisableDCache();
//rGPBCON = 0x155555;
Uart_Init( 0,115200 );
Uart_Select( 0 );
//##########################################################################
while(1)
{
//rGPBDAT =0x7fe;
Delay(1000) ;
//rGPBDAT =0x001;
Delay(1000) ;
Uart_SendByte('g');
//Uart_Printf("SBC2440 Test Program VER1.0\n");
}
//Uart_Init( 0,115200 );
//Uart_Select( 0 );
//Uart_Printf("SBC2440 Test Program VER1.0\n");
}
以上是 我在文档上面扣出来的程序 但是 就是不能在终端上面打印字符
希望各位多多帮忙
...全文
相关推荐
mini2440串口转usb驱动(win7 64bit)
Mini2440开发板通常通过USB转串口芯片(如CH340或CP210x等)来实现与PC的连接,这些芯片需要对应的驱动程序才能正常工作。
mini2440 mdk uart 裸机程序
- 串口通信:通过UART,mini2440可以与其他设备进行串行通信,如PC、GSM模块等。综上所述,理解并掌握mini2440 MDK UART裸机程序设计,对于嵌入式系统的开发者至关重要。
QT4移植到mini2440详细过程分析
**应用程序的移植与调试** - 一旦库移植成功,接下来就是将基于Qt的应用程序移植到mini2440上。这通常涉及到重新编译源代码,链接新编译的Qt库,并解决可能出现的依赖问题。
友善之臂开发板Mini2440用户手册
### 友善之臂开发板Mini2440用户手册知识点总结#### 一、Mini2440开发板介绍##### 1.1 Mini2440开发板简介- **开发板外观**:提供了关于Mini2440开发板外观的详细描述
usb转串口线驱动,64位win7系统可用
mini2440"通常指的是一个基于Samsung S3C2440处理器的嵌入式开发板,它可能需要通过USB转串口线与PC进行通信,以便进行调试、编程或数据交换。


单片机/工控
