From 474217b83e050c8a7d5b1512c4decb82db2bbe64 Mon Sep 17 00:00:00 2001 From: "mr.zhangsan" Date: Tue, 18 Jun 2024 14:17:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9rfid=5Ftask?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- keilp/cc_as_stc02_ps5ws.uvprojx | 25 ++++++++++--------------- source/app/app_config.c | 1 + source/app/task_rfid.c | 7 +++++-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/keilp/cc_as_stc02_ps5ws.uvprojx b/keilp/cc_as_stc02_ps5ws.uvprojx index 49cd302..d897f82 100644 --- a/keilp/cc_as_stc02_ps5ws.uvprojx +++ b/keilp/cc_as_stc02_ps5ws.uvprojx @@ -400,11 +400,6 @@ msp - - time.c - 1 - ..\source\msp\time.c - UART0.C 1 @@ -415,11 +410,6 @@ 1 ..\source\msp\eeprom.c - - uart_x.c - 1 - ..\source\msp\uart_x.c - UART3.c 1 @@ -435,6 +425,11 @@ 1 ..\source\msp\UART4.C + + UARTX.c + 1 + ..\source\msp\UARTX.c + @@ -495,16 +490,16 @@ 1 ..\source\ctask\tick.c + + time.c + 1 + ..\source\ctask\time.c + tpc - - modbus.c - 1 - ..\source\tpc\modbus.c - debug.c 1 diff --git a/source/app/app_config.c b/source/app/app_config.c index cb454b3..13a72f0 100644 --- a/source/app/app_config.c +++ b/source/app/app_config.c @@ -238,6 +238,7 @@ void L3_set_power_mode(U8 mode) } else { + //启用rfid bsp_rfid_en(RFID_ENABLE); //重新初始化RFID任务 L3_task_rfid_init(); diff --git a/source/app/task_rfid.c b/source/app/task_rfid.c index 82e676f..a007db7 100644 --- a/source/app/task_rfid.c +++ b/source/app/task_rfid.c @@ -34,7 +34,8 @@ void L3_task_rfid_init(void) L3_task_s_go(_s_task_rfid,D_task_init); } -#define D_task_RFID_READ 0x50 +#define D_task_RFID_SET 0x50 +#define D_task_RFID_READ 0x51 void L3_task_rfid_handler(S_TASK_RFID *s) { @@ -43,7 +44,10 @@ void L3_task_rfid_handler(S_TASK_RFID *s) L0_uart0_uchex(sizeof(rfidSetWCmd) / sizeof(U8)); L0_uart0_uchex(sizeof(rfidSelCmd) / sizeof(U8)); L0_uart0_uchex(sizeof(rfidLoopRead) / sizeof(U8)); + //注意这里加delay,因为rfid_en是强推挽模式,强推挽模式生效有延迟 + L2_task_go_Tdelay(D_task_RFID_SET,D_Tdelay_300ms); + TTSS_Task_step(D_task_RFID_SET) //1.设置天线 L0_uart4_sendArray(rfidSetChannelCmd, sizeof(rfidSetChannelCmd) / sizeof(U8)); NOP10(); @@ -56,7 +60,6 @@ void L3_task_rfid_handler(S_TASK_RFID *s) //4.启动轮询 L0_uart4_sendArray(rfidLoopRead, sizeof(rfidLoopRead) / sizeof(U8)); NOP10(); - L2_task_go(D_task_RFID_READ); TTSS_Task_step(D_task_RFID_READ)