/** * @file plsr.h * @author zhangcheng * @brief PLSR指令功能接口文件 * @version v0.1 * @date 2025-08-06 * * @copyright Copyright (c) 2025 */ #include "../../modbus/inc/modbus.h" /** * @brief 系统参数块 * @details * @note * @attention */ typedef enum { SYSTEM_PARAM_BLOCK_0 = 0, ///< 系统参数块0,默认参数块,不可修改 SYSTEM_PARAM_BLOCK_1, ///< 系统参数块1 SYSTEM_PARAM_BLOCK_2, ///< 系统参数块2 SYSTEM_PARAM_BLOCK_3, ///< 系统参数块3 SYSTEM_PARAM_BLOCK_4 ///< 系统参数块4 } PLSR_SYSTEM_PARAM_BLOCK; /** * @brief 输出端口 * @details * @note * @attention */ typedef enum { OUTPUT_PORT_Y0 = 0, ///< 输出端子Y0 OUTPUT_PORT_Y1, ///< 输出端子Y1 OUTPUT_PORT_Y2, ///< 输出端子Y2 OUTPUT_PORT_Y3 ///< 输出端子Y3 } PLSR_OUTPUT_PORT; /** * @brief 输出模式 * @details * @note * @attention */ typedef enum { RELATIVE_MODE = 0, ///< 相对模式 ABSOLUTE_MODE ///< 绝对模式 } PLSR_OUTPUT_MODE; /** * @brief 参数错误类型 * @details * @note * @attention */ typedef enum { PLSR_ERROR_NONE = 0, ///< 无错误 PLSR_FREQ_EXCE_MAX_VALUE ///< 超过最大输出频率 } PLSR_ERROR_TYPE; /** * @brief PLSR指令结构类型 * @details * @note * @attention */ typedef struct { uint16_t *dataStartAddr; ///< 起始数据地址 uint16_t *userParamBlockAddr; ///< 用户参数块地址 PLSR_SYSTEM_PARAM_BLOCK systemParamBlock; ///< 系统参数 PLSR_OUTPUT_PORT outputPort; ///< 输出端子 PLSR_OUTPUT_PORT mode; ///< 输出模式 } PLSR_CMD; /** * @brief PLSR功能初始化 * @details * * @param[in] 无 * * @return RESUIL 初始化结果 * @retval MODBUS_TURE 成功 * @retval MODBUS_FALSE 失败 */ RESUIL PLSRInit(void);