User_Dri_main.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #include "User_Dri_main.h"
  2. extern uint16 sendMessagelength;
  3. void User_Dri_main(void) //
  4. {
  5. TargetRef_Process1(); //转速获取
  6. Temp_jisuan(); //温度计算
  7. #if (Debugg==1)
  8. {
  9. /*工具程序*/
  10. PC_MONITOR_MAIN();
  11. senddeal();
  12. }
  13. #else
  14. {
  15. // I_IReal_10 实际电流 P_PowerReal实际功率
  16. //mcTorqueCompensation.TorqueCompensateIqCurrentValue//mcTorqueCompensation.TorqueCompensateIqCurrentValue+3000
  17. // uart_boxing(2, FOC__THETA ,FOC__IA,IPM_RealTemp(AdcSampleValue.ADC_IPM_temp),RealTempjisuan(AdcSampleValue.ADC_paiqi_temp>>3,1),HW_BOARD_VOLT_MAX*mcFocCtrl.mcDcbusFlt/32767,RealTempjisuan(AdcSampleValue.ADC_guan_temp>>3,2),ID_Align_CURRENT_Start);
  18. // UART1deal();
  19. trace2();
  20. }
  21. #endif
  22. }
  23. void User_Dri_timer1ms(void) //
  24. {
  25. if (Uart.uarttimejishu <= 500)
  26. {
  27. Uart.uarttimejishu++;
  28. }
  29. if (Uart.Uart_Tmreset <= 5050)
  30. {
  31. Uart.Uart_Tmreset++;
  32. }
  33. if (Uart.Uart_Tmcomcyc <= 550)
  34. {
  35. Uart.Uart_Tmcomcyc++;
  36. }
  37. if (Uart.Uart_Recivetime <= 200)
  38. {
  39. Uart.Uart_Recivetime++;
  40. }
  41. if ((Uart.TxCnt >= (sendMessagelength - 1)) && (Uart.Uart_Recivetime >= 15))
  42. {
  43. Uart.Recive_Flag = 0;
  44. }
  45. }
  46. void TargetRef_Process1(void)
  47. {
  48. #if (SPEED_MODE == UARTMODE)// uart调速模式
  49. {
  50. #if (Debugg==1)
  51. Trace_Select_write(); //电脑上位机控制指令
  52. #endif
  53. #if (Uart_Select==Uart_MoNi)
  54. UartDealResponse(); //串口上位机数据处理
  55. #elif (Uart_Select==Uart_Yingjian)
  56. #if (Uart_COMMUNICATION==0)
  57. {
  58. UartDealResponse1();
  59. }
  60. #elif (Uart_COMMUNICATION==1)
  61. {
  62. UartDealResponse2();
  63. }
  64. #endif
  65. #endif
  66. }
  67. #elif (SPEED_MODE == NONEMODE)// 直接上电运行模式
  68. {
  69. ConTrolCmd.yajispeed = 5400;//压机闭环目标转速
  70. ConTrolCmd.fengjispeed = 300; //风机闭环目标转速
  71. ConTrolCmd.sitongfa = 1;
  72. }
  73. #endif
  74. //ConTrolCmd.yajispeed = 5400;//压机闭环目标转速
  75. Control_Cmd(); //指令执行
  76. }