60 lines
1.7 KiB
C
60 lines
1.7 KiB
C
#ifndef _MODBUS_HMI
|
|
#define _MODBUS_HMI
|
|
|
|
#include "modbus_struct.h"
|
|
|
|
typedef struct {
|
|
int send_log;
|
|
int new_send_log_checked;
|
|
int log_size_sent;
|
|
// int flag_ready_send_array;
|
|
int flag_data_received;
|
|
int flag_log_array_sent;
|
|
int flag_log_array_ready_sent;
|
|
// int flag_end_of_log;
|
|
int step;
|
|
int number_of_log;
|
|
unsigned long count_write_to_modbus;
|
|
unsigned long current_address;
|
|
unsigned long start_log_address;
|
|
int log_address_step;
|
|
} Logs_with_modbus;
|
|
|
|
extern Logs_with_modbus log_to_HMI;
|
|
|
|
int readDiscreteOutputsFromRemote();
|
|
int writeSigleDiscreteDataToRemote(unsigned int adres);
|
|
int writeSingleAnalogOutputToRemote(unsigned int adres);
|
|
int writeDiscreteDataToRemote();
|
|
int readAnalogDataFromRemote();
|
|
int writeAnalogDataToRemote();
|
|
int sendLogToHMI();
|
|
void setRegisterDiscreteOutput(int value, int adres);
|
|
int getRegisterDiscreteOutput(int adres);
|
|
|
|
|
|
void fillLogArea(); //TODO for testing only
|
|
|
|
void clear_table_remoute(void); // clear table
|
|
|
|
#define LOG_START_ADRES 0xA0000UL
|
|
#define LOG_END_ADRES 0xF0000UL
|
|
#define LOG_BUFFER_SIZE 0x50000UL //0x100UL
|
|
#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 700
|
|
|
|
|
|
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
|