STM32 CAN总线应用程序,调试通过仅供参考(3)
- UID
- 1029342
- 性别
- 男
|
STM32 CAN总线应用程序,调试通过仅供参考(3)
case 91:
if(TQ_A_flag == 0x22)
{
TQ_CON_A = 1;
JDQ_A_Flag |= 0x04;
Net_Node_CapA[0] = Net_Node_CapA[0]|0x04;
}
else if(TQ_A_flag == 0x11)
{
TQ_CON_A = 0;
JDQ_A_Flag &= 0xFB;
Net_Node_CapA[0] = Net_Node_CapA[0]&0xFB;
}
break;
case 92:
if(TQ_A_flag == 0x22)
{
TQ_CON_A = 1;
JDQ_A_Flag |= 0x02;
Net_Node_CapA[0] = Net_Node_CapA[0]|0x02;
}
else if(TQ_A_flag == 0x11)
{
TQ_CON_A = 0;
JDQ_A_Flag &= 0xFD;
Net_Node_CapA[0] = Net_Node_CapA[0]&0xFD;
}
break;
case 93:
if(TQ_A_flag == 0x22)
{
TQ_CON_A = 1;
JDQ_A_Flag |= 0x01;
Net_Node_CapA[0] = Net_Node_CapA[0]|0x01;
}
else if(TQ_A_flag == 0x11)
{
TQ_CON_A = 0;
JDQ_A_Flag &= 0xFE;
Net_Node_CapA[0] = Net_Node_CapA[0]&0xFE;
}
break;
}
}
else
{
Send_add = 0x100 + device_add;
Send_Data[0] = 0x55;
Send_Data[1] = 0x01;
Send_Data[2] =device_add; //从机地址
Send_Data[3] = GFB_flag; //共补投入控制指令
Send_Data[4] = TQ_A_flag;
Send_Data[5] =TQ_B_flag;
num = Send_Data[1] + Send_Data[2] + Send_Data[3] + Send_Data[4] +Send_Data[5];
Send_Data[6] =num&0xFF;
Send_Data[7] = 0xAA;
CanWriteData(Send_add,Send_Data);
switch(GFB_flag)
{
case 90:
if(TQ_A_flag == 0x22)
{
Net_Node_CapA[device_add] = Net_Node_CapA[device_add]|0x07;
}
else if(TQ_A_flag == 0x11)
{
Net_Node_CapA[device_add] =Net_Node_CapA[device_add]&0x00;
}
if(TQ_B_flag == 0x22)
{
Net_Node_CapB[device_add] = Net_Node_CapB[device_add]|0x07;
}
else if(TQ_B_flag == 0x11)
{
Net_Node_CapB[device_add] =Net_Node_CapB[device_add]&0x00;
}
break;
case 91:
if(TQ_A_flag == 0x22)
{
Net_Node_CapA[device_add] = Net_Node_CapA[device_add]|0x04;
}
else if(TQ_A_flag == 0x11)
{
Net_Node_CapA[device_add] =Net_Node_CapA[device_add]&0xFB;
}
break;
case 92:
if(TQ_A_flag == 0x22)
{
Net_Node_CapA[device_add] = Net_Node_CapA[device_add]|0x02;
}
else if(TQ_A_flag == 0x11)
{
Net_Node_CapA[device_add] =Net_Node_CapA[device_add]&0xFD;
}
break;
case 93:
if(TQ_A_flag == 0x22)
{
Net_Node_CapA[device_add] = Net_Node_CapA[device_add]|0x01;
}
else if(TQ_A_flag == 0x11)
{
Net_Node_CapA[device_add] =Net_Node_CapA[device_add]&0xFE;
}
break;
}
}
} |
|
|
|
|
|