| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- /**
- * @file MODBUS_LOW_ATY.h
- *
- * @param Project DEVICE_GENERAL_ATY_LIB
- *
- * @author ATY
- *
- * @copyright
- * - Copyright 2017 - 2023 MZ-ATY
- * - This code follows:
- * - MZ-ATY Various Contents Joint Statement -
- * <a href="https://mengze.top/MZ-ATY_VCJS">
- * https://mengze.top/MZ-ATY_VCJS</a>
- * - CC 4.0 BY-NC-SA -
- * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
- * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
- * - Your use will be deemed to have accepted the terms of this statement.
- *
- * @brief Familiar functions of modbus for all device
- *
- * @version
- * - 1_01_221029 > ATY
- * -# Preliminary version, first Release
- ********************************************************************************
- */
- #ifndef __MODBUS_LOW_ATY_H
- #define __MODBUS_LOW_ATY_H
- #include "INCLUDE_ATY.h"
- #include "ALGO_CRC_ATY.h"
- #include "HW_UART_ATY.h"
- /******************************* For user *************************************/
- // #define MODBUS_FLOAT_MODE
- #define MODBUS_FLOAT_CODE_MODE
- /* define sample */
- // #include "HW_UART_ATY.h"
- // #define MODBUS_REG_HOLDING_SIZE 60 // set --model-large at 51
- // #include "MODBUS_LOW_ATY.h"
- // #define mbG mbRegHoding
- #include "main.h"
- #ifndef MODBUS_REG_HOLDING_SIZE
- #define MODBUS_REG_HOLDING_SIZE 50 // set --model-large at 51
- #endif
- #ifndef MODBUS_ADDR
- #define MODBUS_ADDR 0x01
- #endif
- // #ifdef __STC51_ATY // move to INCLUDE.h
- // #define BIG_ENDIAN // chip in big endian mode
- // #endif
- /******************************************************************************/
- #define MODBUS_FUNC_READ_COILS 0x01
- #define MODBUS_FUNC_READ_DISCRETE_INPUTS 0x02
- #define MODBUS_FUNC_READ_HOLDING_REGISTERS 0x03
- #define MODBUS_FUNC_READ_INPUT_REGISTERS 0x04
- #define MODBUS_FUNC_WRITE_SINGLE_COIL 0x05
- #define MODBUS_FUNC_WRITE_SINGLE_HOLDING_REGISTERS 0x06
- #define MODBUS_FUNC_WRITE_MULTY_HOLDING_REGISTERS 0x10
- #if defined (MODBUS_FLOAT_MODE) || defined(MODBUS_FLOAT_CODE_MODE)
- #ifndef MUL_FLOAT
- #define MUL_FLOAT 1000
- #endif /* MUL_FLOAT */
- extern __XDATA float mbRegHoding[MODBUS_REG_HOLDING_SIZE];
- #else
- extern uint16_t mbRegHoding[MODBUS_REG_HOLDING_SIZE];
- #endif /* MODBUS_FLOAT_MODE */
- void Modbus_Process(uint8_t* buf, uint8_t len);
- #endif /* __MODBUS_LOW_ATY_H */
- /******************************** End Of File *********************************/
|