mirror of
https://gitea.ecohim.ru:3000/RS485_Relay/RS485_Relay2_fw.git
synced 2025-08-07 16:20:30 +03:00
initial commit
This commit is contained in:
32
Core/Inc/modbus_logic.h
Normal file
32
Core/Inc/modbus_logic.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* user_modbus.h
|
||||
*
|
||||
* Created on: 13 <20><><EFBFBD>. 2019 <20>.
|
||||
*/
|
||||
|
||||
#ifndef MODBUS_LOGIC_H_
|
||||
#define MODBUS_LOGIC_H_
|
||||
#include <stdint.h>
|
||||
|
||||
#define BOARD_ADRESS 34 //Relay Module 1
|
||||
//#define BOARD_ADRESS 35 //Relay Module 2
|
||||
|
||||
#define BUS_IDLE_TIME 3
|
||||
|
||||
#define MODBUS_PROTOCOL_VERSION (1)
|
||||
#define MODBUS_HEADER_SIZE (13)
|
||||
#define BUFFERS_SIZE (100 + 9)
|
||||
#define MAX_REGS_PER_QUERY (32)
|
||||
#define ADDRESS_UNDEFINED (0xff)
|
||||
|
||||
enum recv_state {RECV_IDLE, RECV_READ_HEADER, RECV_READ_DATA, RECV_READ_COMPLETE, RECV_ERROR};
|
||||
enum send_state {SEND_IDLE, SEND_BUSY};
|
||||
|
||||
void UART_RxCpltCallback(void);
|
||||
void UART_TxCpltCallback(void);
|
||||
|
||||
void modbus_loop_iterate();
|
||||
uint8_t read_register(uint16_t address, uint16_t* value);
|
||||
uint8_t write_register(uint16_t address, uint16_t value);
|
||||
|
||||
#endif /* MODBUS_LOGIC_H_ */
|
Reference in New Issue
Block a user