| 
									
										
										
										
											2019-11-26 13:16:25 +08:00
										 |  |  | /*=====================================================================================
 | 
					
						
							|  |  |  |  * Description: | 
					
						
							|  |  |  |  *   The Modbus parameter structures used to define Modbus instances that | 
					
						
							|  |  |  |  *   can be addressed by Modbus protocol. Define these structures per your needs in | 
					
						
							|  |  |  |  *   your application. Below is just an example of possible parameters. | 
					
						
							|  |  |  |  *====================================================================================*/ | 
					
						
							|  |  |  | #ifndef _DEVICE_PARAMS
 | 
					
						
							|  |  |  | #define _DEVICE_PARAMS
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // This file defines structure of modbus parameters which reflect correspond modbus address space
 | 
					
						
							|  |  |  | // for each modbus register type (coils, discreet inputs, holding registers, input registers)
 | 
					
						
							|  |  |  | #pragma pack(push, 1)
 | 
					
						
							|  |  |  | typedef struct | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     uint8_t discrete_input0:1; | 
					
						
							|  |  |  |     uint8_t discrete_input1:1; | 
					
						
							|  |  |  |     uint8_t discrete_input2:1; | 
					
						
							|  |  |  |     uint8_t discrete_input3:1; | 
					
						
							|  |  |  |     uint8_t discrete_input4:1; | 
					
						
							|  |  |  |     uint8_t discrete_input5:1; | 
					
						
							|  |  |  |     uint8_t discrete_input6:1; | 
					
						
							|  |  |  |     uint8_t discrete_input7:1; | 
					
						
							|  |  |  |     uint8_t discrete_input_port1:8; | 
					
						
							|  |  |  | } discrete_reg_params_t; | 
					
						
							|  |  |  | #pragma pack(pop)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma pack(push, 1)
 | 
					
						
							|  |  |  | typedef struct | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     uint8_t coils_port0; | 
					
						
							|  |  |  |     uint8_t coils_port1; | 
					
						
							|  |  |  | } coil_reg_params_t; | 
					
						
							|  |  |  | #pragma pack(pop)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma pack(push, 1)
 | 
					
						
							|  |  |  | typedef struct | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     float input_data0; | 
					
						
							|  |  |  |     float input_data1; | 
					
						
							|  |  |  |     float input_data2; | 
					
						
							|  |  |  |     float input_data3; | 
					
						
							| 
									
										
										
										
											2020-07-22 00:34:04 +08:00
										 |  |  |     uint16_t data[150]; | 
					
						
							| 
									
										
										
										
											2019-11-26 13:16:25 +08:00
										 |  |  | } input_reg_params_t; | 
					
						
							|  |  |  | #pragma pack(pop)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma pack(push, 1)
 | 
					
						
							|  |  |  | typedef struct | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     float holding_data0; | 
					
						
							|  |  |  |     float holding_data1; | 
					
						
							|  |  |  |     float holding_data2; | 
					
						
							|  |  |  |     float holding_data3; | 
					
						
							| 
									
										
										
										
											2020-03-30 22:05:48 +08:00
										 |  |  |     uint16_t test_regs[150]; | 
					
						
							| 
									
										
										
										
											2019-11-26 13:16:25 +08:00
										 |  |  | } holding_reg_params_t; | 
					
						
							|  |  |  | #pragma pack(pop)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern holding_reg_params_t holding_reg_params; | 
					
						
							|  |  |  | extern input_reg_params_t input_reg_params; | 
					
						
							|  |  |  | extern coil_reg_params_t coil_reg_params; | 
					
						
							|  |  |  | extern discrete_reg_params_t discrete_reg_params; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // !defined(_DEVICE_PARAMS)
 |