您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

96 行
2.1 KiB

  1. /**
  2. * @file plsr.h
  3. * @author zhangcheng
  4. * @brief PLSR指令功能接口文件
  5. * @version v0.1
  6. * @date 2025-08-06
  7. *
  8. * @copyright Copyright (c) 2025
  9. */
  10. #include "../../modbus/inc/modbus.h"
  11. /**
  12. * @brief 系统参数块
  13. * @details
  14. * @note
  15. * @attention
  16. */
  17. typedef enum {
  18. SYSTEM_PARAM_BLOCK_0 = 0, ///< 系统参数块0,默认参数块,不可修改
  19. SYSTEM_PARAM_BLOCK_1, ///< 系统参数块1
  20. SYSTEM_PARAM_BLOCK_2, ///< 系统参数块2
  21. SYSTEM_PARAM_BLOCK_3, ///< 系统参数块3
  22. SYSTEM_PARAM_BLOCK_4 ///< 系统参数块4
  23. } PLSR_SYSTEM_PARAM_BLOCK;
  24. /**
  25. * @brief 输出端口
  26. * @details
  27. * @note
  28. * @attention
  29. */
  30. typedef enum {
  31. OUTPUT_PORT_Y0 = 0, ///< 输出端子Y0
  32. OUTPUT_PORT_Y1, ///< 输出端子Y1
  33. OUTPUT_PORT_Y2, ///< 输出端子Y2
  34. OUTPUT_PORT_Y3 ///< 输出端子Y3
  35. } PLSR_OUTPUT_PORT;
  36. /**
  37. * @brief 输出模式
  38. * @details
  39. * @note
  40. * @attention
  41. */
  42. typedef enum {
  43. RELATIVE_MODE = 0, ///< 相对模式
  44. ABSOLUTE_MODE ///< 绝对模式
  45. } PLSR_OUTPUT_MODE;
  46. /**
  47. * @brief 参数错误类型
  48. * @details
  49. * @note
  50. * @attention
  51. */
  52. typedef enum {
  53. PLSR_ERROR_NONE = 0, ///< 无错误
  54. PLSR_FREQ_EXCE_MAX_VALUE ///< 超过最大输出频率
  55. } PLSR_ERROR_TYPE;
  56. /**
  57. * @brief PLSR指令结构类型
  58. * @details
  59. * @note
  60. * @attention
  61. */
  62. typedef struct
  63. {
  64. uint16_t *dataStartAddr; ///< 起始数据地址
  65. uint16_t *userParamBlockAddr; ///< 用户参数块地址
  66. PLSR_SYSTEM_PARAM_BLOCK systemParamBlock; ///< 系统参数
  67. PLSR_OUTPUT_PORT outputPort; ///< 输出端子
  68. PLSR_OUTPUT_PORT mode; ///< 输出模式
  69. } PLSR_CMD;
  70. /**
  71. * @brief PLSR功能初始化
  72. * @details
  73. *
  74. * @param[in] 无
  75. *
  76. * @return RESUIL 初始化结果
  77. * @retval MODBUS_TURE 成功
  78. * @retval MODBUS_FALSE 失败
  79. */
  80. RESUIL PLSRInit(void);