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