Browse Source

修改485波特率9600

dev
mr.zhangsan 1 year ago
parent
commit
36adf4ed4b
  1. 3
      source/bsp/TTSSbsp/bsp_config.h
  2. 4
      source/debug/debug_drv.c
  3. 12
      source/msp/uart/msp_uart1.c

3
source/bsp/TTSSbsp/bsp_config.h

@ -166,7 +166,8 @@
//串口配置 //串口配置
/// #define D_UART1_BRT BRT_460800 /// #define D_UART1_BRT BRT_460800
/// #define D_UART1_BRT BRT_921600 /// #define D_UART1_BRT BRT_921600
#define D_UART1_BRT BRT_115200 // #define D_UART1_BRT BRT_115200
#define D_UART1_BRT BRT_9600
#define D_UART1_SBIT SBIT_1 #define D_UART1_SBIT SBIT_1
#define D_PIN_UART1 PIN_UART1_Rxd_30_Txd_31 #define D_PIN_UART1 PIN_UART1_Rxd_30_Txd_31
#define D_UART2_BRT BRT_115200///BRT_921600///BRT_115200/// #define D_UART2_BRT BRT_115200///BRT_921600///BRT_115200///

4
source/debug/debug_drv.c

@ -119,7 +119,7 @@ u8 L3_tpc_hex(void)
return 1; return 1;
} }
} }
printfs("\r\n cmd error!!"); // printfs("\r\n cmd error!!");
return 0; return 0;
} }
#endif #endif
@ -132,7 +132,7 @@ vtype L2_debug_ONcomand(void)
{ {
ts_Urec[D_UART1].debugok = 0;////解析协议 ts_Urec[D_UART1].debugok = 0;////解析协议
/// printf("\r\nw ts_Urec[D_UART1].max = %d num = %d",(int)ts_Urec[D_UART1].rmax,(int)ts_Urec[D_UART1].num); /// printf("\r\nw ts_Urec[D_UART1].max = %d num = %d",(int)ts_Urec[D_UART1].rmax,(int)ts_Urec[D_UART1].num);
printf1("\r\ndebugok %2x",(int)ts_Urec[D_UART1].debugok); // printf1("\r\ndebugok %2x",(int)ts_Urec[D_UART1].debugok);
} }
if(1 == ts_Urec[D_UART1].ok) if(1 == ts_Urec[D_UART1].ok)

12
source/msp/uart/msp_uart1.c

@ -105,6 +105,18 @@ msp/uartx.c 底层代码 和cpu相关 缓存发送也放在里面
#elif(BRT_19200 == D_UART1_BRT) #elif(BRT_19200 == D_UART1_BRT)
#elif(BRT_9600== D_UART1_BRT) #elif(BRT_9600== D_UART1_BRT)
void L0_uart1_init(void) //9600bps@22.1184MHz
{
SCON = 0x50; //8位数据,可变波特率
AUXR |= 0x40; //定时器时钟1T模式
AUXR &= 0xFE; //串口1选择定时器1为波特率发生器
TMOD &= 0x0F; //设置定时器模式
TL1 = 0xC0; //设置定时初始值
TH1 = 0xFD; //设置定时初始值
ET1 = 0; //禁止定时器中断
TR1 = 1; //定时器1开始计时
}
#warning "MainFre_22M BRT_115200"
#else///9600 #else///9600
#endif//) #endif//)

Loading…
Cancel
Save