matlab_23550/Inu/Src/main/message_modbus.h
2024-12-27 10:50:32 +03:00

62 lines
2.5 KiB
C

#ifndef _MESSAGE_MODBUS_H
#define _MESSAGE_MODBUS_H
// void ReceiveCommandModbus3(RS_DATA *rs_arr);
// void ReceiveCommandModbus16(RS_DATA *rs_arr);
// void ReceiveCommandModbus15(RS_DATA *rs_arr);
// void SendCommandModbus3(RS_DATA *rs_arr,int adr_contr, unsigned int adr_start,unsigned int count_word);
// void SendCommandModbus16(RS_DATA *rs_arr,int adr_contr, unsigned int adr_start,unsigned int count_word);
// void ReceiveAnswerCommandModbus16(RS_DATA *rs_arr);
// void ReceiveAnswerCommandModbus3(RS_DATA *rs_arr);
#define TIME_PAUSE_MODBUS_MPU 250 //100//500
#define TIME_PAUSE_MODBUS_REMOUTE 20 //100 //500
#define TIME_PAUSE_NETWORK_CAN1 444 //500
#define TIME_PAUSE_NETWORK_CAN2 990 //500
#define TIME_PAUSE_NETWORK_CAN3 1855 //500
//#define START_ADR_ARR 0xc000
//#define LENGTH_ADR_ARR 0x100
//#define SIZE_MODBUS_TABLE_DISCRETE_REMOUTE 36 // = 576/16
#define SIZE_BUF_WRITE_TO_MODBUS1_REMOUTE SIZE_MODBUS_TABLE_DISCRET_REMOUTE // SIZE_MODBUS_TABLE_DISCRET_BITS //576 //Ïðè ðàçìåðå ïîñûëêè áîëüøå 3 áàéò modbus ñèìóëßòîð ãîâîðèò ÷òî íå ïðàâèëüíûé ôîðìàò ïîñûëêè.
#define SIZE_BUF_WRITE_TO_MODBUS15_REMOUTE SIZE_MODBUS_TABLE_DISCRET_REMOUTE //SIZE_MODBUS_TABLE_DISCRET_BITS //576 //96
#define SIZE_BUF_WRITE_TO_MODBUS16_VPU 100 //
#define SIZE_BUF_WRITE_TO_MODBUS16_REMOUTE 120 //100 // ïåðåäà÷à, ðàçìåð â îäíîé ïîñûëêå àíàëîã.÷àñòè ïóëüòà ÁÑÓ, íå áîëüøå SIZE_ANALOG_DATA_REMOUTE
#define SIZE_ANALOG_DATA_REMOUTE 240 //165 // ïåðåäà÷à, ðàçìåð äàííûõ ïî àíàëîãîâîé ÷àñòè ïóëüòà ÁÑÓ
#define SIZE_BUF_READ_FROM_MODBUS16_REMOUTE 120 //20//36 // ïðèåì, ðàçìåð â îäíîé ïîñûëêå àíàëîã.÷àñòè ïóëüòà ÁÑÓ, íå áîëüøå SIZE_ANALOG_DATA_FROM_MODBUS16_REMOUTE
#define SIZE_ANALOG_DATA_FROM_MODBUS16_REMOUTE SIZE_ANALOG_DATA_REMOUTE //20//36 // ïðèåì, ðàçìåð äàííûõ ïî àíàëîãîâîé ÷àñòè ïóëüòà ÁÑÓ
#define SIZE_BUF_WRITE_TO_MODBUS16_CAN 100 //10 //1000//400//04.04.2012 //100// //800
#define START_LOG_MODBUS16_ADRES 100
#define SIZE_BUF_WRITE_LOG_TO_MODBUS16 120
//#define SIZE_ANALOG_DATA 61
#define MAX_COUNT_ERROR_FROM_RS_MPU 10
//void test_rs_can_with_svu_mpu();
void write_all_data_to_mpu_can(int run_force, unsigned int pause);
void read_all_data_from_mpu_485(int run_force);
void write_all_data_to_mpu_485(int run_force);
extern int enable_can;
int modbusNetworkSharing(int flag_update_only_hmi);
int modbusNetworkSharingCAN(void);
#endif //_MESSAGE_MODBUS_H