Browse Source

feature: 1.添加 用户自定义下载(实现不停电下载)功能

v4-isp
Zhangwen 4 months ago
parent
commit
94abf2eaee
  1. 3
      .vscode/settings.json
  2. 14
      source/msp/UART0.C
  3. 3
      source/msp/msp/msp_uart_x.h

3
.vscode/settings.json

@ -86,6 +86,7 @@
"setjmp.h": "c",
"algorithm": "c",
"task_w600_ptc.h": "c",
"task_adc.h": "c"
"task_adc.h": "c",
"msp_uart_x.h": "c"
}
}

14
source/msp/UART0.C

@ -2,6 +2,8 @@
#include "uart0.h"
#include "uartx.h"
#define Self_Define_ISP_Download_Command 0x3D //用户自定义下载(实现不停电下载)
void L0_uart0_init(void)
{
@ -51,14 +53,24 @@ UART 中断
*************************************************/
void INTERRUPT_UART(void) D_SERVE_UART
{
u16 a,b;
// NOP(); NOP(); NOP();
if (L0_uart0_IntRI()) //如果是U0接收中断
{
L0_uart0_IntRIClear(); //清除接收中断标志
ts_uart[uNum0].r.reg = SBUF; //获取当前数据
//用户自定义下载,实现不停电下载(第一次烧录程序仍需断电,后续不再需要,使用STC-ISP软件)
if (SBUF == Self_Define_ISP_Download_Command)
{
for(a = 1000;a > 0;a--)
for(b = 100;b > 0;b--);
IAP_CONTR = 0x60;
}
L0_uartN_s2b(uNum0); //接收数据至缓冲区
}
if (L0_uart0_IntTI()) //如果是U0发送中断
if (L0_uart0_IntTI()) //如果是U0发送中断
{
L0_uart0_IntTIClear(); //清除发送中断标志
if (ts_uart[uNum0].s.max > ts_uart[uNum0].s.now)

3
source/msp/msp/msp_uart_x.h

@ -46,7 +46,7 @@ msp/uartx.c 底层代码 和cpu相关 缓存发送也放在里面
L0_UART0_Init
UART0_IRQHandler
L0_Usend_uc------UserDef
-----------------------------------------------------------------------------------------
---------------------------------------------------------------------------------
********************************************************************************/
@ -62,6 +62,7 @@ msp/uartx.c 底层代码 和cpu相关 缓存发送也放在里面
#define D_BRT_COUNT(t,clk,uartBRT) (U16)(65536- (clk / (4 * uartBRT * t)))
typedef struct _ts_uart0_send_buf_
{
vU8 num; //接收到的数目注意数据长度的范围

Loading…
Cancel
Save