user_mb_app.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef USER_APP
  2. #define USER_APP
  3. /* ----------------------- Modbus includes ----------------------------------*/
  4. #include "mb.h"
  5. #include "mbconfig.h"
  6. #include "mbframe.h"
  7. #include "mbutils.h"
  8. typedef enum {
  9. REG_MIN = 0x00,
  10. Air_condition_switch = 0x01,
  11. Air_condition_mode = 0x02,
  12. Air_wind_speed = 0x03,
  13. Air_set_temp = 0x04,
  14. Relay_Sta_Read = 0x05,
  15. Floor_heating_switch = 0x06,
  16. Floor_heating_temp = 0x07,
  17. Relay_Switch = 0x08,
  18. Fresh_air_switch = 0x09,
  19. Fresh_air_Param = 0x0a,
  20. Fresh_air_wind_speed = 0x0b,
  21. Compensates_temp = 0x0c,
  22. Real_time_temp = 0x0d,
  23. Real_time_Humidity = 0x0e,
  24. Real_time_Fa_param = 0x0f,
  25. Air_condition_Relay = 0x10,
  26. Floor_heating_Relay = 0x11,
  27. Fresh_air_reg = 0x12,
  28. Ltemp_Protection_valve = 0x13,
  29. Lock_screen = 0x14,
  30. Full_Half_Lock = 0x15,
  31. Data_send = 0x16,
  32. Led_Brightness = 0x17,
  33. Env_Light = 0x18,
  34. Sleep_time_addr = 0x19,
  35. Code_Version = 0x1a,
  36. Reserve_1 = 0x1b,
  37. Temperature_Unit = 0x1c,
  38. Temperature_Down_limit = 0x1D,
  39. Temperature_Up_limit = 0x1E,
  40. REG_MAX,
  41. }reg_def;
  42. /* -----------------------Slave Defines -------------------------------------*/
  43. #define S_DISCRETE_INPUT_START 0
  44. #define S_DISCRETE_INPUT_NDISCRETES 8
  45. #define S_COIL_START 0
  46. #define S_COIL_NCOILS 8
  47. #define S_REG_INPUT_START 0
  48. #define S_REG_INPUT_NREGS 4
  49. #define S_REG_HOLDING_START 0
  50. #define S_REG_HOLDING_NREGS 128
  51. /* -----------------------Slave Defines -------------------------------------*/
  52. extern UCHAR ucMBAddress;
  53. extern USHORT usSRegHoldBuf[S_REG_HOLDING_NREGS];
  54. #define local_addr_broadcast MB_ADDRESS_BROADCAST
  55. #define local_addr ucMBAddress
  56. #define Reg_sta usSRegHoldBuf
  57. extern uint8_t * MakeMessage(uint16_t addr, uint16_t value);
  58. extern uint8_t * MakeMultiMessage_KT(void);
  59. extern uint8_t * MakeMultiMessage_DN(void);
  60. extern uint8_t * MakeMultiMessage_XF(void);
  61. extern BOOL ReportActively (const UCHAR * request, USHORT reqlen);
  62. extern BOOL ReportEnabled (void);
  63. #endif