|
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Copyright (c) $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ 肖遥电子(广州)研发中心 $ Shawyoo Electronics (GuangZhou) R&D Center $ http://www.shawyoo.com Email: autoele@qq.com $ QQ群:9069471/9069433/9524253 All rights reserved. $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Copyright (c) $$$$$$$$$$$$$$$$$$$$$$$$$$$ */ /* 文件描述 文件名: 功能描述: 编译环境: 目标CPU: 作者: 创建时间: 建议编辑环境:UltraEdit 11.00a+ 制表符宽度为三个字符,程序可读性更好。 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ #ifndef __UART0_H__ #define __UART0_H__
#i nclude "RTOS.h" #i nclude <string.h> #i nclude "UserGlobals.h"
// $$$$$$$$$$$$$$$$$$ <<< Use Configuration Wizard in Context Menu >>> $$$$$$$$$$$$$$$$$ // <h>请选择是否使用UART,不使用则不占资源
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // <o>USE_UART: 我要使用UART? <0=> 不使用 <1=> 使用 // <i> Default: 使用 */ #define USE_UART 0
// <h>UART0初始化相关配置(CPU主频在CPU.h文件中设置)
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // <o>UART0_BPS: 串口波特率设置 <1-250000> // <i> Default: 9600 */ #define UART0_BPS 9600
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // <o>U0_DATA_BIT: 数据位配置 <0=> 5位 <1=> 6位 <2=> 7位 <3=> 8位 // <i> Default: 3 */ #define U0_DATA_BIT 3
// <e>禁止或使能校验位
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // <o>U0_CHECK_BIT_EN: 校验位使能 <0=> 禁止校验 <1=> 允许校验 // <i> Default: 1 */ #define U0_CHECK_BIT_EN 1
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // <o>U0_CHECK_BIT: 校验位配置 <0=> 奇校验 <1=> 偶校验 <2=> 强制1 <3=> 强制0 // <i> Default: 0 */ #define U0_CHECK_BIT 0
// </e>
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // <o>U0_STOP_BIT: 停止位配置 <0=> 1位 <1=> 2位 // <i> Default: 0 */ #define U0_STOP_BIT 0
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // <o>U0_PROIRITY: 串口中断优先级 <0=> 不优先 <1=> 优先 // <i> Default: 1 */ #define U0_PROIRITY 1
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // <o>UART0_REC_LENGTH: 接收缓冲区长度字节设置 <1-1024> // <i> Default: 100 */ #define UART0_REC_LENGTH 150
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // <o>UART0_TXD_LENGTH: 发送缓冲区长度字节设置 <1-1024> // <i> Default: 100 */ #define UART0_TXD_LENGTH 1500
// </h>
// </h>
// $$$$$$$$$$$$$$$$$$$ <<< end of configuration section >>> $$$$$$$$$$$$$$$$$$$$$$$$$$$$
#ifdef UART0_GLOBALS #define UART0_EXT #else #define UART0_EXT extern #endif
#define OWN_ADDRESS 1 #define LEAD_OK 0x55 #define LENGTH_OK 0xaa
#define FIFO_LENGTH 14
#define DATA_START_ADDR 6
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 接收相关变量定义 */ UART0_EXT struct { uchar Buffer[UART0_REC_LENGTH]; uchar CheckSum,OverTime; uchar Command,Error,Receiving; uint16 Counter,Length; } Rec;
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ UART0_EXT struct { uchar Buffer[UART0_TXD_LENGTH+12]; uchar CheckSum,Sending; uint16 Length; } Txd; UART0_EXT uchar *TxdP;
uchar PutString(uchar *); uchar PutBuffer(uchar,uint16,uchar *); void Uart0_SendChar(uchar data); void ClearReceiveFlag(uint16); void ClearTransmitFlag(void);
void TaskUART0_ReceiveOK(void) __task;
#endif
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ End of File $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ |