User_Dri_main.c 1.8 KB

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