commution.h 3.6 KB

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