Browse Source

回退成之前的电机变频器

master
Lizongdi 2 weeks ago
parent
commit
8e59e36557
  1. 24
      diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_Strong_grinding_machine.c

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

@ -31,24 +31,31 @@ void strong_grinding_machine_intialize(struct UARTHandler *Handler)
// 测试,转速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, 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_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;
// 测试,转速20rpm
int32_t strong_grinding_machine_speed = 10;
void Strong_grinding_machine_cmd(void)
{
strong_grinding_machine_speed = GV.PV.main_axis_speed / 15;//公式是转速除以60/p,是极对数,极对数是极数的一半。当前电机极数是8,所以是除以15
strong_grinding_machine_speed = GV.PV.main_axis_speed;
switch(strong_grinding_machine_cmd_flag)
{
case 0:
//发速度
MB_WriteHoldingReg(&Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount,
0x01, 0x4000, strong_grinding_machine_speed);
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;
@ -66,6 +73,9 @@ void Strong_grinding_machine_cmd(void)
else{
}
strong_grinding_machine_cmd_flag = 0;
break;
}
}

Loading…
Cancel
Save