12 changed files with 219 additions and 14 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,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