commution.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /**
  2. @file commution.h
  3. @version V1.0.0
  4. @author jaise
  5. @date 2023-8-16 09:35:55
  6. @brief This file contains ...
  7. @copyright Copyright(C) 2022 Fortior Technology Co., Ltd. All rights reserved.
  8. */
  9. #ifndef __COMMUTION_H__
  10. #define __COMMUTION_H__
  11. // Include external header file.
  12. #if (Uart_COMMUNICATION==0)
  13. #define RX_LEN 20
  14. #define TX_LEN 20
  15. #elif (Uart_COMMUNICATION==1)
  16. #define RX_LEN 23
  17. #define TX_LEN 23
  18. #endif
  19. #define RX_ZHENTOU 0x00
  20. #define TX_ZHENTOU 0x95
  21. #define RX_LEN1 8
  22. #define TX_LEN1 11
  23. #define RX_ZHENTOU1 0x81
  24. #define TX_ZHENTOU1 0x28
  25. #define T_mreset 5000 //5000ms
  26. #define T_mrxerr 180 //180s
  27. #define T_mchgerr 120 //120s
  28. #define T_mtxcyc 230 //230ms
  29. #define T_mcomcyc 500 //500ms
  30. #define T_mfrmwt 25 //25ms
  31. #define T_mwtchg 50 //50ms
  32. #define evnodd 0 //0: ????1:???
  33. typedef union
  34. {
  35. uint8 DATA00;
  36. struct
  37. {
  38. uint8 DATA0 : 1; //DATA1.0
  39. uint8 DATA1 : 1; //DATA1.1
  40. uint8 DATA2 : 1; //DATA1.2
  41. uint8 DATA3 : 1; //DATA1.3
  42. uint8 DATA4 : 1; //DATA1.4
  43. uint8 DATA5 : 1; //DATA1.5
  44. uint8 DATA6 : 1; //DATA1.6
  45. uint8 DATA7 : 1; //DATA1.7
  46. } bf;
  47. } ddatet00;
  48. //????typedef struct
  49. typedef union
  50. {
  51. uint8 DATAT00;
  52. struct
  53. {
  54. uint8 DATA0 : 1; //DATA1.0
  55. uint8 DATA1 : 1; //DATA1.1
  56. uint8 DATA2 : 1; //DATA1.2
  57. uint8 DATA3 : 1; //DATA1.3
  58. uint8 DATA4 : 1; //DATA1.4
  59. uint8 DATA5 : 1; //DATA1.5
  60. uint8 DATA6 : 1; //DATA1.6
  61. uint8 DATA7 : 1; //DATA1.7
  62. } bf;
  63. } MCUART_Rec00;
  64. typedef struct
  65. {
  66. uint8 R_DATA[42];
  67. uint8 T_DATA[42];
  68. int16 uarttimejishu;
  69. uint8 recive_lenth;
  70. uint16 Uart_Tmreset;
  71. uint16 Uart_Tmcomcyc;
  72. uint8 Uart_Recivetime;
  73. uint8 Oder;
  74. uint8 Recive_Flag;
  75. uint8 recive_sussf_falg;
  76. uint8 send_start_falg;
  77. uint8 sussf_falg;
  78. uint8 sendflag;
  79. uint8 ResponseFlag;
  80. uint16 time_cnt;
  81. uint16 time_shuju;
  82. uint8 UartReadTemp;
  83. uint8 UartReadCnt;
  84. uint8 TxCnt;
  85. uint8 send_delay_time;
  86. uint16 YaJI_Speed;
  87. uint16 FengSpeed;
  88. int16 PengZhangFa;
  89. int16 PengZhangFa_ACT;
  90. uint8 u1IduRevDataCnt;
  91. } MCUART;
  92. extern MCUART xdata Uart;
  93. extern uint8 BBC(uint8 * puchMsg, uint8 usDataLen);
  94. extern unsigned char u1_cnt_idu_comm_task;
  95. extern MCUART_Rec00 xdata Uart_Rec_DATA00;
  96. extern MCUART_Rec00 xdata Uart_Rec_DATA01;
  97. extern MCUART_Rec00 xdata Uart_Rec_DATA02;
  98. extern MCUART_Rec00 xdata Uart_Rec_DATA03;
  99. extern MCUART_Rec00 xdata Uart_Rec_DATA04;
  100. extern MCUART_Rec00 xdata Uart_Rec_DATA05;
  101. extern MCUART_Rec00 xdata Uart_Rec_DATA06;
  102. extern MCUART_Rec00 xdata Uart_Rec_DATA09;
  103. extern MCUART_Rec00 xdata Uart_Rec_DATA10;
  104. extern MCUART_Rec00 xdata Uart_Rec_DATA12;
  105. extern MCUART_Rec00 xdata Uart_Rec_DATA13;
  106. extern MCUART_Rec00 xdata Uart_Rec_DATA14;
  107. extern MCUART_Rec00 xdata Uart_Rec_DATA15;
  108. extern void UartRecive1(void);
  109. extern void UartSend1(void);
  110. extern void UartDealResponse1(void);
  111. extern void UartDealResponse2(void);
  112. extern void Uart_Int01(void);
  113. extern void Uart_Int02(void);
  114. extern void Uart_Int_Finsh(void);
  115. extern void Uart_Run01(void);
  116. extern void Uart_Run02(void);
  117. extern void Uart_Run03(void);
  118. #endif