#ifndef _MODBUS_HMI
#define _MODBUS_HMI

#include "modbus_struct.h"


int readDiscreteOutputsFromRemote();
int writeSigleDiscreteDataToRemote(unsigned int adres);
int writeSingleAnalogOutputToRemote(unsigned int adres);
int writeDiscreteDataToRemote();
int readAnalogDataFromRemote();
int writeAnalogDataToRemote();
int writeSingleAnalogDataToRemote(int from_adr, int count_wr);

void setRegisterDiscreteOutput(int value, int adres);
int getRegisterDiscreteOutput(int adres);




void clear_table_remoute(void); // clear table

#define ADRES_LOG_REGISTERS     100


#define SIZE_MODBUS_TABLE_DISCRET_REMOUTE                   36
#define SIZE_MODBUS_TABLE_DISCRET_BITS                      (SIZE_MODBUS_TABLE_DISCRET_REMOUTE * 16)
#define SIZE_MODBUS_ANALOG_REMOUTE                          900


extern MODBUS_REG_STRUCT modbus_table_analog_in[SIZE_MODBUS_ANALOG_REMOUTE];
extern MODBUS_REG_STRUCT modbus_table_analog_out[SIZE_MODBUS_ANALOG_REMOUTE];
extern MODBUS_REG_STRUCT modbus_table_discret_in[SIZE_MODBUS_TABLE_DISCRET_REMOUTE];
extern MODBUS_REG_STRUCT modbus_table_discret_out[SIZE_MODBUS_TABLE_DISCRET_REMOUTE];

//extern unsigned int flag_waiting_answer;
//extern unsigned int flag_message_sent;

#endif //_MODBUS_HMI
