257 lines
6.9 KiB
C
257 lines
6.9 KiB
C
/*
|
|
* CAN_project.h
|
|
*
|
|
* Created on: 21 ěŕ˙ 2020 ă.
|
|
* Author: yura
|
|
*/
|
|
|
|
#ifndef SRC_MAIN_CAN_PROJECT_H_
|
|
#define SRC_MAIN_CAN_PROJECT_H_
|
|
|
|
|
|
#include "can_protocol_ukss.h"
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
// íŕńňđîéęŕ áŕçîâűő ŕäđĺńîâ CAN
|
|
// PCH_1 čëč PCH_2 âűáčđŕĺňń˙ äćŕěďĺđîâ íŕ ĎĚ67
|
|
//////////////////////////////////////////////////////////////////
|
|
#define CAN_BASE_ADR_MPU_PCH_1 0x0CEB0E1
|
|
#define CAN_BASE_ADR_MPU_PCH_2 0x0CEB0E1 //0x0CEB0E2
|
|
//////////////////////////////////////
|
|
#define CAN_BASE_ADR_TERMINAL_PCH_1 0x0EEEE01
|
|
#define CAN_BASE_ADR_TERMINAL_PCH_2 0x0EEEE03
|
|
//////////////////////////////////////
|
|
#define CAN_BASE_ADR_UNITS_PCH_1 0x235500
|
|
#define CAN_BASE_ADR_UNITS_PCH_2 0x235500
|
|
//////////////////////////////////////
|
|
#define CAN_BASE_ADR_ALARM_LOG_PCH_1 0x0BCDEF01
|
|
#define CAN_BASE_ADR_ALARM_LOG_PCH_2 0x0BCDEF02
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
//#define CAN_PROTOCOL_VERSION 1
|
|
#define CAN_PROTOCOL_VERSION 2
|
|
|
|
#define CAN_SPEED_BITS 125000
|
|
//#define CAN_SPEED_BITS 250000
|
|
//#define CAN_SPEED_BITS 500000
|
|
|
|
|
|
|
|
#define ENABLE_CAN_SEND_TO_UKSS_FROM_MAIN 1
|
|
#define ENABLE_CAN_SEND_TO_MPU_FROM_MAIN 1
|
|
#define ENABLE_CAN_SEND_TO_TERMINAL_FROM_MAIN 0//1
|
|
#define ENABLE_CAN_SEND_TO_TERMINAL_OSCIL 0//1
|
|
#define ENABLE_CAN_SEND_TO_ANOTHER_BSU_FROM_MAIN 1
|
|
|
|
|
|
//////////////////////////////////////////////////////
|
|
|
|
#ifndef ENABLE_CAN_SEND_TO_UKSS_FROM_MAIN
|
|
#define ENABLE_CAN_SEND_TO_UKSS_FROM_MAIN 0
|
|
#endif
|
|
|
|
#ifndef ENABLE_CAN_SEND_TO_MPU_FROM_MAIN
|
|
#define ENABLE_CAN_SEND_TO_MPU_FROM_MAIN 0
|
|
#endif
|
|
|
|
|
|
#ifndef ENABLE_CAN_SEND_TO_TERMINAL_FROM_MAIN
|
|
#define ENABLE_CAN_SEND_TO_TERMINAL_FROM_MAIN 0
|
|
#endif
|
|
|
|
#ifndef ENABLE_CAN_SEND_TO_TERMINAL_OSCIL
|
|
#define ENABLE_CAN_SEND_TO_TERMINAL_OSCIL 0
|
|
#endif
|
|
|
|
#ifndef ENABLE_CAN_SEND_TO_ANOTHER_BSU_FROM_MAIN
|
|
#define ENABLE_CAN_SEND_TO_ANOTHER_BSU_FROM_MAIN 0
|
|
#endif
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
// setup ukss boxs
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
// íŕäî đŕçđĺěŕđčňü óńňđîéńňâŕ ęîňîđűĺ čńďîëüçóţňń˙
|
|
#define USE_UKSS_0 1
|
|
#define USE_UKSS_1 1
|
|
#define USE_UKSS_2 1
|
|
#define USE_UKSS_3 1
|
|
#define USE_UKSS_4 1
|
|
//#define USE_UKSS_5 1
|
|
//#define USE_UKSS_6 1
|
|
//#define USE_UKSS_7 1
|
|
//#define USE_UKSS_8 1
|
|
//#define USE_UKSS_9 1
|
|
//#define USE_UKSS_10 1
|
|
//#define USE_UKSS_11 1
|
|
//#define USE_UKSS_12 1
|
|
//#define USE_UKSS_13 1
|
|
//#define USE_UKSS_14 1
|
|
//#define USE_UKSS_15 1
|
|
|
|
|
|
|
|
#define OFFSET_CAN_ADR_UNITS 0x10
|
|
|
|
// Äŕĺě îńěűńëĺííűĺ íŕçâŕíč˙ ˙ůčęŕě
|
|
|
|
#if USE_UKSS_0
|
|
#define ZADATCHIK_CAN 0 //Zadatchik
|
|
#endif
|
|
|
|
#if USE_UKSS_1
|
|
#define VPU_CAN 1 //VPU
|
|
#endif
|
|
|
|
#if USE_UKSS_2
|
|
#define UMU_CAN_DEVICE 2 //Voltage control UMU
|
|
#endif
|
|
|
|
#if USE_UKSS_3
|
|
#define BKSSD_CAN_DEVICE 3 //AC DRIVE
|
|
#endif
|
|
|
|
|
|
#if USE_UKSS_4
|
|
#define ANOTHER_BSU1_CAN_DEVICE 4 //Another BSU1
|
|
// Unites revers box or not
|
|
// revers box used only on CAN between BS1 BS2
|
|
//#define USE_R_B_4 1 //0
|
|
#endif
|
|
|
|
|
|
//#if USE_UKSS_5
|
|
//#define ANOTHER_BSU2_CAN_DEVICE 5 //Another BSU2
|
|
//// Unites revers box or not
|
|
//// revers box used only on CAN between BS1 BS2
|
|
////#define USE_R_B_5 1 //0
|
|
//#endif
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
// setup mpu boxes
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
// íŕäî đŕçđĺěŕđčňü óńňđîéńňâŕ ęîňîđűĺ čńďîëüçóţňń˙
|
|
#define USE_MPU_0 1
|
|
#define USE_MPU_1 1
|
|
//#define USE_MPU_2 1
|
|
//#define USE_MPU_3 1
|
|
|
|
|
|
#define OFFSET_CAN_ADR_MPU 0x10
|
|
|
|
//#define MPU_CAN_DEVICE 2 // MPU
|
|
#define TIME_PAUSE_CAN_FROM_MPU 1000
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
// setup terminal boxes
|
|
///////////////////////////////////////////////////////////////////
|
|
// íŕäî đŕçđĺěŕđčňü óńňđîéńňâŕ ęîňîđűĺ čńďîëüçóţňń˙
|
|
#define USE_TERMINAL_1_OSCIL 1
|
|
#define USE_TERMINAL_1_CMD 1
|
|
#define USE_TERMINAL_2_OSCIL 1
|
|
#define USE_TERMINAL_2_CMD 1
|
|
|
|
|
|
#define OFFSET_CAN_ADR_TERMINAL 0x10
|
|
#define TIME_PAUSE_CAN_FROM_TERMINAL 2
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
// setup ALARM_LOG box
|
|
///////////////////////////////////////////////////////////////////
|
|
#define USE_ALARM_LOG_0 1
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
// setup can_open boxes
|
|
///////////////////////////////////////////////////////////////////
|
|
//#define BWC_CAN_DEVICE 7 // Water cooler
|
|
//#define INGITIM 9
|
|
|
|
//#define BWC_CAN_FATEC 1
|
|
//#define BWC_CAN_SIEMENS 1
|
|
//#define INGITIM_CAN_OPEN 1
|
|
|
|
|
|
#define CANOPENUNIT_LEN 30
|
|
|
|
|
|
/////////words from zadatchik from Ingitim
|
|
#define PDO1_W1_ADR 0x11
|
|
#define PDO1_W2_ADR 0x12
|
|
#define PDO1_W3_ADR 0x13
|
|
#define PDO1_W4_ADR 0x14
|
|
#define PDO2_W1_ADR 0x15
|
|
#define PDO2_W2_ADR 0x16
|
|
#define PDO2_W3_ADR 0x17
|
|
#define PDO2_W4_ADR 0x18
|
|
#define PDO3_W1_ADR 0x19
|
|
#define PDO3_W2_ADR 0x1A
|
|
#define PDO3_W3_ADR 0x1B
|
|
#define PDO3_W4_ADR 0x1C
|
|
#define PDO5_W1_ADR 0x1D
|
|
#define PDO5_W2_ADR 0x1E
|
|
#define PDO5_W3_ADR 0x1F
|
|
#define PDO5_W4_ADR 0x20
|
|
#define PDO6_W1_ADR 0x21
|
|
#define PDO6_W2_ADR 0x22
|
|
#define PDO6_W3_ADR 0x23
|
|
#define PDO6_W4_ADR 0x24
|
|
//////////////////////////////////////
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////
|
|
#define UNITS_NUMERATION_FROM_0_OR_1 0 //1
|
|
|
|
|
|
#define MAX_CAN_WAIT_TIMEOUT 7500 // 2500
|
|
//-------------------------------------------------//
|
|
|
|
//#define CAN_ADR_TEST_LAMP 0x0CE031 //0x1CE030
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////
|
|
// äë˙ ukss äĺôŕéíű
|
|
//////////////////////////////////////////////////////////////////
|
|
#define ADR_CAN_NUMBER1_ON_ZAD 0x00
|
|
#define ADR_CAN_NUMBER2_ON_ZAD 0x01
|
|
#define ADR_CAN_LAMPS_ON_ZAD 0x02
|
|
#define ADR_CAN_LAMPS_2_ON_ZAD 0x03
|
|
#define ADR_CAN_KEY_ON_ZAD 0x10
|
|
|
|
//////////////////////////////////////
|
|
//////////////////////////////////////
|
|
|
|
#define CAN_SPEED_UKSS8 10
|
|
#define CAN_SPEED_VPU1 20
|
|
#define CAN_SPEED_VPU2 20
|
|
#define CAN_SPEED_UMP1 5//30
|
|
|
|
//#define ADR_CAN_SPEED 99
|
|
//#define ADR_CAN_LENGTH_FINISH_ADR 97
|
|
//#define ADR_CAN_CMD 127
|
|
//#define ADR_CAN_KEY_ON_VPU 16 //
|
|
//#define ADR_CAN_DOOR 0 //
|
|
|
|
|
|
//////////////////////////////////////
|
|
//////////////////////////////////////
|
|
|
|
|
|
|
|
#endif /* SRC_MAIN_CAN_PROJECT_H_ */
|