/*
 * Modbus_registers.h
 *
 *  Created on: 9. 3. 2020
 *      Author: Ondrej Vitoslavsky
 */

#ifndef MODBUS_REGISTERS_H_
#define MODBUS_REGISTERS_H_


#define HOLDING_REGISTERS 128

//Holding register offsets
//Main
#define BOM_OFFSET 	0
#define SW_VERSION_OFFSET 	1
#define HW_VERSION_OFFSET 	2

//DATA OUT
#define SAMPLE_COUNT_OFFSET 8
#define STATUS_OFFSET		9
#define A_OFFSET 	12
#define B_OFFSET 	14
#define AB2_OFFSET 	16
#define TI_OFFSET 	18
#define T_OFFSET 	20
#define T_1_OFFSET 	22
#define T_2_OFFSET 	24
#define T_3_OFFSET 	26
#define T_4_OFFSET 	28
#define T_5_OFFSET 	30
#define T_6_OFFSET 	32
#define T_7_OFFSET 	34
#define T_8_OFFSET 	36
#define T_9_OFFSET 	38
#define T_10_OFFSET 40
#define T_11_OFFSET 42
#define T_12_OFFSET 44
#define T_13_OFFSET 46
#define T_14_OFFSET 48
#define T_15_OFFSET 50
#define T_BUFFER_SIZE (T_15_OFFSET-T_OFFSET)


#define AO_0_OFFSET 60
#define AO_1_OFFSET 62



//SETTINGS
#define SETTINGS_OFFSET 64

#define INP_SC_OFFSET 		SETTINGS_OFFSET
#define INP_OF_OFFSET 		(SETTINGS_OFFSET+2)
#define RDG_SC_OFFSET 		(SETTINGS_OFFSET+4)
#define RDG_OF_OFFSET 		(SETTINGS_OFFSET+6)
#define AO_TYPE_OFFSET 		(SETTINGS_OFFSET+8)
#define AO0_RANGE_OFFSET 	(SETTINGS_OFFSET+9)
#define AO0_NOMINAL_OFFSET 	(SETTINGS_OFFSET+11)
#define AO1_RANGE_OFFSET 	(SETTINGS_OFFSET+13)
#define AO1_NOMINAL_OFFSET 	(SETTINGS_OFFSET+15)
#define T_LIMITATION_OFFSET (SETTINGS_OFFSET+17)
#define AD_RATE_OFFSET 		(SETTINGS_OFFSET+19)

//DATA IN
#define COMMAND_OFFSET 		97
#define SIMULATE_NOMINAL	98
#define SIMULATE_THICKNESS 	100




#endif /* MODBUS_REGISTERS_H_ */
