7 changed files with 118 additions and 57 deletions
@ -0,0 +1,20 @@ |
|||||
|
/*
|
||||
|
* msp_Strong_grinding_machine.h |
||||
|
* |
||||
|
* Created on: 2026年3月27日 |
||||
|
* Author: 13752 |
||||
|
*/ |
||||
|
|
||||
|
#ifndef BASE_INC_MSP_MSP_STRONG_GRINDING_MACHINE_H_ |
||||
|
#define BASE_INC_MSP_MSP_STRONG_GRINDING_MACHINE_H_ |
||||
|
|
||||
|
#include "bsp_UART.h" |
||||
|
#include "BHBF_ROBOT.h" |
||||
|
#include "msp_zhr29_200_laser_sensor.pb.h" |
||||
|
#include "bsp_MB_host.h" |
||||
|
|
||||
|
extern uint8_t strong_grinding_machine_cmd; |
||||
|
|
||||
|
extern void strong_grinding_machine_intialize(struct UARTHandler *Handler); |
||||
|
|
||||
|
#endif /* BASE_INC_MSP_MSP_STRONG_GRINDING_MACHINE_H_ */ |
||||
@ -0,0 +1,88 @@ |
|||||
|
/*
|
||||
|
* msp_Strong_grinding_machine.c |
||||
|
* |
||||
|
* Created on: 2026年3月27日 |
||||
|
* Author: 13752 |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
#include "msp_Strong_grinding_machine.h" |
||||
|
|
||||
|
static struct UARTHandler *Strong_grinding_machine_handler; |
||||
|
static DispacherController *Strong_grinding_machine_dispacherController; |
||||
|
|
||||
|
static void Strong_grinding_machine_cmd(void); |
||||
|
//static void decode_Strong_grinding_machine(uint8_t *buffer, uint16_t length);
|
||||
|
|
||||
|
static const uint8_t inquiry_interval = 50; |
||||
|
|
||||
|
void strong_grinding_machine_intialize(struct UARTHandler *Handler) |
||||
|
{ |
||||
|
Strong_grinding_machine_handler = Handler; |
||||
|
|
||||
|
Strong_grinding_machine_handler->Wait_time = 10; |
||||
|
|
||||
|
Strong_grinding_machine_dispacherController = Handler->dispacherController; |
||||
|
Strong_grinding_machine_dispacherController->Dispacher_Enable = 1; |
||||
|
Strong_grinding_machine_dispacherController->DispacherCallTime = 100; |
||||
|
Strong_grinding_machine_dispacherController->Add_Dispatcher_List(Strong_grinding_machine_dispacherController, |
||||
|
Strong_grinding_machine_cmd); |
||||
|
} |
||||
|
|
||||
|
// 测试,转速20rpm
|
||||
|
const uint8_t strong_grinding_machine_set_speed_cmd[8] = {0x01, 0x06, 0x00, 0x02, 0x00, 0x14, 0x28, 0x05}; |
||||
|
const uint8_t strong_grinding_machine_start_cmd[8] = {0x01, 0x06, 0x00, 0x01, 0x08, 0x82, 0x5F, 0xAB}; |
||||
|
const uint8_t strong_grinding_machine_stop_cmd[8] = {0x01, 0x06, 0x00, 0x01, 0x08, 0x81, 0x1F, 0xAA}; |
||||
|
|
||||
|
static uint8_t strong_grinding_machine_cmd_flag = 0; |
||||
|
uint8_t strong_grinding_machine_cmd = 0; |
||||
|
const uint16_t strong_grinding_machine_speed = 20; |
||||
|
|
||||
|
void Strong_grinding_machine_cmd(void) |
||||
|
{ |
||||
|
switch(strong_grinding_machine_cmd_flag) |
||||
|
{ |
||||
|
case 0: |
||||
|
|
||||
|
MB_WriteHoldingReg(&Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount, |
||||
|
0x01, 0x0002, strong_grinding_machine_speed); |
||||
|
// Strong_grinding_machine_handler->TxCount = 8;
|
||||
|
// memcpy(&Strong_grinding_machine_handler->Tx_Buf, &strong_grinding_machine_set_speed_cmd, Strong_grinding_machine_handler->TxCount);
|
||||
|
Strong_grinding_machine_handler->AddSendList(Strong_grinding_machine_handler, Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount, |
||||
|
inquiry_interval, NULL); |
||||
|
strong_grinding_machine_cmd_flag = 1; |
||||
|
break; |
||||
|
case 1: |
||||
|
if(strong_grinding_machine_cmd == 0) |
||||
|
{ |
||||
|
Strong_grinding_machine_handler->TxCount = 8; |
||||
|
memcpy(&Strong_grinding_machine_handler->Tx_Buf, &strong_grinding_machine_stop_cmd, Strong_grinding_machine_handler->TxCount); |
||||
|
Strong_grinding_machine_handler->AddSendList(Strong_grinding_machine_handler, Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount, |
||||
|
inquiry_interval, NULL); |
||||
|
} |
||||
|
else if(strong_grinding_machine_cmd == 1) |
||||
|
{ |
||||
|
Strong_grinding_machine_handler->TxCount = 8; |
||||
|
memcpy(&Strong_grinding_machine_handler->Tx_Buf, &strong_grinding_machine_start_cmd, Strong_grinding_machine_handler->TxCount); |
||||
|
Strong_grinding_machine_handler->AddSendList(Strong_grinding_machine_handler, Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount, |
||||
|
inquiry_interval, NULL); |
||||
|
} |
||||
|
else{ |
||||
|
|
||||
|
} |
||||
|
strong_grinding_machine_cmd_flag = 0; |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
@ -1,47 +0,0 @@ |
|||||
CAN指令 |
|
||||
|
|
||||
81 00 00 00 00 00 00 00 复位所有节点 |
|
||||
|
|
||||
01 00 00 00 00 00 00 00 启动所有节点的远程控制 |
|
||||
|
|
||||
|
|
||||
步骤1(复位节点)和步骤2(启动节点)的帧ID是“0x0000”,其余的步骤的帧ID为SDO的地址0X0600+节点号 |
|
||||
|
|
||||
|
|
||||
2b 40 60 00 06 00 00 00 写控制字06H,状态机切换状态 |
|
||||
|
|
||||
2b 40 60 00 07 00 00 00 写控制字07H,状态机切换状态 |
|
||||
|
|
||||
2b 40 60 00 0f 00 00 00 写控制字0FH,状态机切换状态 |
|
||||
|
|
||||
|
|
||||
一、速度模式发以下指令 |
|
||||
|
|
||||
2f 60 60 00 03 00 00 00 速度模式 |
|
||||
|
|
||||
23 ff 60 00 A0 86 01 00 正转 |
|
||||
|
|
||||
23 ff 60 00 60 79 FE FF 反转 |
|
||||
|
|
||||
23 ff 60 00 00 00 00 00 停车 |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
二、位置模式发以下指令 |
|
||||
2f 60 60 00 01 00 00 00 位置模式 |
|
||||
|
|
||||
23 81 60 00 A0 86 01 00 写速度 |
|
||||
|
|
||||
23 7a 60 00 A0 86 01 00 正转10圈(5mm) |
|
||||
|
|
||||
23 7a 60 00 60 79 FE FF 反转10圈(5mm) |
|
||||
|
|
||||
23 7a 60 00 C0 D4 01 00 正转12圈(6mm) |
|
||||
|
|
||||
23 7a 60 00 40 2B FE FF 反转12圈(6mm) |
|
||||
|
|
||||
2b 40 60 00 4f 00 00 00 设置为相对运动模式 |
|
||||
|
|
||||
2b 40 60 00 5f 00 00 00 电机开始运动 |
|
||||
|
|
||||
@ -1,6 +1,6 @@ |
|||||
2F62501ED4689FB349E356AB974DBE57=1E2381E617183AADF4456CCD6D53D61D |
2F62501ED4689FB349E356AB974DBE57=A84465D0AB7FC85C43037569F99B7E82 |
||||
635E684B79701B039C64EA45C3F84D30=0A24CDD2C9C910977CCC6D7CA9CB0612 |
635E684B79701B039C64EA45C3F84D30=0A24CDD2C9C910977CCC6D7CA9CB0612 |
||||
66BE74F758C12D739921AEA421D593D3=0 |
66BE74F758C12D739921AEA421D593D3=0 |
||||
8DF89ED150041C4CBC7CB9A9CAA90856=1E2381E617183AADF4456CCD6D53D61D |
8DF89ED150041C4CBC7CB9A9CAA90856=A84465D0AB7FC85C43037569F99B7E82 |
||||
DC22A860405A8BF2F2C095E5B6529F12=BFAB4159B488818C3ED3C0C9D5058F5A |
DC22A860405A8BF2F2C095E5B6529F12=87EF6E86AD82C44D77A3A904E01D2A08 |
||||
eclipse.preferences.version=1 |
eclipse.preferences.version=1 |
||||
|
|||||
@ -1,6 +1,6 @@ |
|||||
2F62501ED4689FB349E356AB974DBE57=C1FAD6334016FA4DBFEEBFD567ADCF8D |
2F62501ED4689FB349E356AB974DBE57=072A9A3C3EA2FF5DA5BFC344F13F526F |
||||
635E684B79701B039C64EA45C3F84D30=0A24CDD2C9C910977CCC6D7CA9CB0612 |
635E684B79701B039C64EA45C3F84D30=0A24CDD2C9C910977CCC6D7CA9CB0612 |
||||
66BE74F758C12D739921AEA421D593D3=0 |
66BE74F758C12D739921AEA421D593D3=0 |
||||
8DF89ED150041C4CBC7CB9A9CAA90856=C1FAD6334016FA4DBFEEBFD567ADCF8D |
8DF89ED150041C4CBC7CB9A9CAA90856=072A9A3C3EA2FF5DA5BFC344F13F526F |
||||
DC22A860405A8BF2F2C095E5B6529F12=68A7121F69F6593E9817CACB2B0CB8AF |
DC22A860405A8BF2F2C095E5B6529F12=87EF6E86AD82C44D77A3A904E01D2A08 |
||||
eclipse.preferences.version=1 |
eclipse.preferences.version=1 |
||||
|
|||||
Loading…
Reference in new issue