Browse Source

解决发送不均匀导致的刀具转速不稳定,放弃之前的写法

master
Lizongdi 2 weeks ago
parent
commit
a8ab5da09a
  1. 18
      diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_Strong_grinding_machine.c

18
diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_Strong_grinding_machine.c

@ -34,28 +34,21 @@ const uint8_t strong_grinding_machine_set_speed_cmd[8] = {0x01, 0x06, 0x00, 0x02
const uint8_t strong_grinding_machine_start_cmd[8] = {0x01, 0x06, 0x20, 0x00, 0x00, 0x01, 0x43, 0xCA}; const uint8_t strong_grinding_machine_start_cmd[8] = {0x01, 0x06, 0x20, 0x00, 0x00, 0x01, 0x43, 0xCA};
const uint8_t strong_grinding_machine_stop_cmd[8] = {0x01, 0x06, 0x20, 0x00, 0x00, 0x00, 0x82, 0x0A}; const uint8_t strong_grinding_machine_stop_cmd[8] = {0x01, 0x06, 0x20, 0x00, 0x00, 0x00, 0x82, 0x0A};
static uint8_t strong_grinding_machine_cmd_flag = 0;
uint8_t strong_grinding_machine_cmd = 0; uint8_t strong_grinding_machine_cmd = 0;
// 测试,转速20rpm // 测试,转速20rpm
int32_t strong_grinding_machine_speed = 10; int32_t strong_grinding_machine_speed = 10;
void Strong_grinding_machine_cmd(void) void Strong_grinding_machine_cmd(void)
{ {
strong_grinding_machine_speed = GV.PV.main_axis_speed; strong_grinding_machine_speed = GV.PV.main_axis_speed / 15;//公式是转速除以60/p,是极对数,极对数是极数的一半。当前电机极数是8,所以是除以15
switch(strong_grinding_machine_cmd_flag)
{
case 0:
//发速度
MB_WriteHoldingReg(&Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount, MB_WriteHoldingReg(&Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount,
0x01, 0x4000, strong_grinding_machine_speed); 0x01, 0x4000, 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, Strong_grinding_machine_handler->AddSendList(Strong_grinding_machine_handler, Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount,
inquiry_interval, NULL); inquiry_interval, NULL);
strong_grinding_machine_cmd_flag = 1;
break; //发是否旋转
case 1:
if(strong_grinding_machine_cmd == 0) if(strong_grinding_machine_cmd == 0)
{ {
Strong_grinding_machine_handler->TxCount = 8; Strong_grinding_machine_handler->TxCount = 8;
@ -73,9 +66,6 @@ void Strong_grinding_machine_cmd(void)
else{ else{
} }
strong_grinding_machine_cmd_flag = 0;
break;
}
} }

Loading…
Cancel
Save