From 1295c6a8af313db098295ddcf7c456c6e65c92a2 Mon Sep 17 00:00:00 2001 From: Zhangwen <13970730+mkc46119@user.noreply.gitee.com> Date: Tue, 15 Apr 2025 10:52:16 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A1.=E4=BF=AE=E5=A4=8D=E6=9B=B4?= =?UTF-8?q?=E6=8D=A2cpu=E4=B8=BAstc8h8k=E5=90=8Emucid=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/main.c | 22 +++++++++++++++------- source/bsp/bsp_config.c | 1 - source/bsp/bsp_config.h | 10 ++++++++-- source/bsp/chipid.c | 15 +++++++++++++-- source/bsp/chipid.h | 1 + 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/source/app/main.c b/source/app/main.c index eecb14e..f2108c8 100644 --- a/source/app/main.c +++ b/source/app/main.c @@ -74,16 +74,24 @@ void main(void) //任务初始化 L0_TASK_init(); - //获取mcu id - L0_id_get_rom(G.mcu_id); - L0_uart0_sendstr("MCU_ID = "); - L0_uart0_sendArrayHex(G.mcu_id,7); + // // 获取mcu id + // L0_id_get_rom(G.mcu_id); + // L0_uart0_sendstr("MCU_ID = "); + // L0_uart0_sendArrayHex(G.mcu_id,7); + // L0_uart0_0d0a(); + + //获取MCUID + L0_id_get_chipid(); L0_uart0_0d0a(); - //版本信息 - L0_uart0_sendstr("Version info : "); - L0_uart0_sendArray("PEN_V3",6); + L0_uart0_sendstr("MCU_ID = "); + L0_uart0_sendArrayHex(G.mcu_id, MSP_ID_LEN); L0_uart0_0d0a(); + // //版本信息 + // L0_uart0_sendstr("Version info : "); + // L0_uart0_sendArray("PEN_V3",6); + // L0_uart0_0d0a(); + while(1) { if(1 == s_nos_tick.t1s_heartbeat)//1s diff --git a/source/bsp/bsp_config.c b/source/bsp/bsp_config.c index 4c62c21..92e2464 100644 --- a/source/bsp/bsp_config.c +++ b/source/bsp/bsp_config.c @@ -22,7 +22,6 @@ //初始化为NULL,timer0_isr中判断为NULL则不调用 //========================================================== - void L0_board_config(void) { #if (PIN_UART0_Rxd_30_Txd_31 == D_PIN_UART0) diff --git a/source/bsp/bsp_config.h b/source/bsp/bsp_config.h index 21a3d22..b917d89 100644 --- a/source/bsp/bsp_config.h +++ b/source/bsp/bsp_config.h @@ -77,7 +77,14 @@ #define D_MCU_NAME "STC8H3K64S4" //存储器特殊参数地址配置 - #define D_MCU_SPEC_PARAM_CHIPID 0xFDF9 + #define MSP_ID_LEN 7 + #define D_MCU_SPEC_PARAM_ID_IN_RAM 0x00F1 + #define D_MCU_SPEC_PARAM_ID_IN_ROM 0xFDF9 + #define D_MCU_SPEC_PARAM_ID_IN_CHIPID 0xFDE0 + #define ID_ADDR_IN_RAM ((char idata *)(D_MCU_SPEC_PARAM_ID_IN_RAM + 0x00)) + #define ID_ADDR_IN_ROM ((char code *)(D_MCU_SPEC_PARAM_ID_IN_ROM + 0x00)) + #define ID_ADDR_IN_CHIPID ((unsigned char volatile xdata *)(D_MCU_SPEC_PARAM_ID_IN_CHIPID + 0x00)) + //...其他参数 #if ((TYPE_MCU & TYPE_MCU_VENDOR_MSK) == TYPE_MCU_VENDOR_STC) @@ -320,7 +327,6 @@ L1_tick_tick extern void L0_board_config(void); - #endif//_BSP_CONFIG_H /*********************************end file*********************************************/ diff --git a/source/bsp/chipid.c b/source/bsp/chipid.c index 7df0dc3..99cad66 100644 --- a/source/bsp/chipid.c +++ b/source/bsp/chipid.c @@ -11,8 +11,9 @@ ////////////////////////////////////////////////////////////////////////////// #include "chipid.h" #include "../bsp/bsp_config.h" +#include "../app/app_config.h" -#define MSP_ID_LEN 7 +// #define MSP_ID_LEN 7 void L0_id_get(U8 *id) { @@ -27,13 +28,23 @@ void L0_id_get(U8 *id) void L0_id_get_rom(U8 *id) { U8 i = 0; - char *ID = (char code *)(D_MCU_SPEC_PARAM_CHIPID); + char *ID = (char code *)(D_MCU_SPEC_PARAM_ID_IN_ROM); for(i=0;i