MC95FG204 Uart发送程序
来源:互联网 发布:数据统计报告 编辑:程序博客网 时间:2024/06/05 05:08
#include "Extent.h" //
#include "MC95FG204.h" // peripheral
#include "Const.h" // constant
#define MyDef extern //
#include "Variable.h" // RAM, Bit define
#include "Intrins.h"
//95gf204的串口测试程序 2009-2-14
#define BAUD_9600 25 // @4MHz
#define BAUD_19200 12
#define BAUD_38400 6
#define BAUD_57600 3
#define BAUD_115200 1
//======================================================================
// task : Uart0 Packet Communication full-duplex
// input :
// R02 TX0
// R03 RX0
//======================================================================
void Delay(void)
{unsigned char i,j;
for(i=0;i<224;i++);
for(j=0;j<244;j++);
}
void Uart_Initial(void)
{
UCTRL1 = 0x06; // 8bit asyn
UCTRL2 = 0x8A; //?建议只开数据寄存器空中断,只允许发送 0x8A
UCTRL3 = 0x00; //
UBAUD = BAUD_9600; // default BAUD = 9600 bps
USTAT = 0x00;
}
//----------------------------------------------------------------------
// task : Uart0 transmission start
//----------------------------------------------------------------------
void put_c(unsigned char c)
{
UDATA=c;
//USTAT &= 0xbf;
while(!(USTAT&0x40)); //TXC=1 exit
USTAT=0x00;
}
void Uart_Transmit(void)
{
put_c(0x65);
//Delay();
put_c(0x66);
//Delay();
put_c(0x67);
//Delay();
put_c(0x68);
//Delay();
put_c(0x69);
}
void port_initial(void)
{
P0IO=0xFD;
P0=0xFC;
P0OD=0xC0;
P0PU=0xC2;
P0PC=0;
}
void main(void)
{
unsigned char i;
WDTR=0xFF;
BCCR=0x0E;
BCCR=0x0E;
IE3=0x10; // BIT time interrupt
IE=0x80;
SCCR=0x81;
PCON=0x03; // stop1
_nop_();
_nop_();
_nop_();
_nop_();
//SCCR=0x80;
port_initial();
Delay();
Delay();
Delay();
Delay();
Delay();
Delay();
Delay();
Delay();
Delay();
Delay();
Uart_Initial(); //打开使能
for(i=0;i<20;i++)
{
Uart_Transmit();
Delay();
}
while(1);
UCTRL2 = 0x80;
}
void BIT_Int(void) interrupt 22 using 1
{
//P11=~P11;
_nop_();
}
这个程序用uart不断发送efghi 这5个字母给PC,经测试,功能正常。
- MC95FG204 Uart发送程序
- AVR USART(UART)发送中断程序 使用缓冲器
- UART 发送方式
- UART(串口发送模块)
- UART发送16进制
- UART发送字符串
- UART的发送FIFO问题
- MC95FG204 External Oscillator test
- 裸奔程序之UART
- s5pv210v2-----tinyv210---Uart程序
- TX2440裸机程序-uart
- UART中断方式发送无反应
- Zstack之uart中断方式数据发送
- ARM中断编写及UART发送
- uart接收改为指定函数发送
- STM32 UART(接收 ,发送数据)
- OK6410 uart 简单测试程序
- FriendlyARM UART裸机程序源码
- 关于Dll中导出string的问题
- Eclipse 架构分析和应用(Eclipse平台架构技术分析及基于RCP的应用研究)
- 查询某字段所存在的所有表
- Dev C++ 4.9.9.4调试的问题
- 随笔:需求管理系统
- MC95FG204 Uart发送程序
- Web fpt上传
- 设计模式-Bridge
- liferay5.1.2+netbeans6.5+struts(apache) sample install
- dos批处理选择菜单方法
- 如何在C++获得系统时间(转)
- 用EditPlus搭建简易的Java开发环境
- 编写ASP.NET应用程序的技巧
- 表格列宽鼠标拖动