From ce6fcce60c6ff9e797a818d17df09e9f02d92501 Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Fri, 16 Oct 2026 14:34:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E485=E7=94=B5=E6=9C=BA?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E6=BA=90=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core/BASE/Inc/MSP/msp_LeiSai_485.h | 16 +++++ .../Core/BASE/Src/MSP/msp_LeiSai_485.c | 71 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Inc/MSP/msp_LeiSai_485.h create mode 100644 diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Inc/MSP/msp_LeiSai_485.h b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Inc/MSP/msp_LeiSai_485.h new file mode 100644 index 0000000..c596123 --- /dev/null +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Inc/MSP/msp_LeiSai_485.h @@ -0,0 +1,16 @@ +/* + * msp_LeiSai_485.h + * + * Created on: 2025年12月19日 + * Author: xsq + */ + +#ifndef BASE_INC_MSP_MSP_LEISAI_485_H_ +#define BASE_INC_MSP_MSP_LEISAI_485_H_ +#include "BHBF_ROBOT.h" + + + +extern uint8_t LS_485Motors_Speed; + +#endif /* BASE_INC_MSP_MSP_LEISAI_485_H_ */ diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c new file mode 100644 index 0000000..9c1830b --- /dev/null +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c @@ -0,0 +1,71 @@ +/* + * msp_LeiSai_485.c + * + * Created on: 2025年12月19日 + * Author: xsq + */ + +#include "msp_LeiSai_485.h" +#include "BHBF_ROBOT.h" +//雷赛485电机 + + +struct UARTHandler *LS_485Motors_handler; +DispacherController *LS_485Motors_dispacherController; +uint8_t LS_485Motors_slave_id = 0x00; //默认为0 广播形式 +uint8_t LS_485Motors_Speed=0; +uint8_t speedModeSet=1; + +void LS_485Motor_loop(); + +void LS_485Motors_intialize(struct UARTHandler *Handler) +{ + + LS_485Motors_handler = Handler; + LS_485Motors_handler->Wait_time = 20; //等待10ms 最低不要低于4; + LS_485Motors_dispacherController = Handler->dispacherController; + LS_485Motors_dispacherController->Dispacher_Enable = 1; + //不周期性发送 + LS_485Motors_dispacherController->Add_Dispatcher_List( + LS_485Motors_dispacherController, LS_485Motor_loop); + + LOG("LS_485Motors_intialize"); +} + +void LS_485Motor_loop() +{ + + /*雷赛485电机控制*/ + if(speedModeSet==1) + { + MB_WriteHoldingReg(&LS_485Motors_handler->Tx_Buf, + &LS_485Motors_handler->TxCount, LS_485Motors_slave_id, 0x6208, 0x02);//PR1为速度模式 + + LS_485Motors_handler->AddSendList(LS_485Motors_handler, + LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, OneLineWaitTime, + NULL); + + speedModeSet=0; + } + + MB_WriteHoldingReg(&LS_485Motors_handler->Tx_Buf, + &LS_485Motors_handler->TxCount, LS_485Motors_slave_id, 0x620B, LS_485Motors_Speed);//PR1速度 + + LS_485Motors_handler->AddSendList(LS_485Motors_handler, + LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, OneLineWaitTime, + NULL); + + MB_WriteHoldingReg(&LS_485Motors_handler->Tx_Buf, + &LS_485Motors_handler->TxCount, LS_485Motors_slave_id, 0x6002, 0x11);//PR1运行 + + LS_485Motors_handler->AddSendList(LS_485Motors_handler, + LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, OneLineWaitTime, + NULL); + + + + +} + + +