2025-01-13 11:09:58 +03:00
2024-12-27 10:50:32 +03:00
# ifndef _ADC_TOOLS
# define _ADC_TOOLS
# include "IQmathLib.h"
# include "xp_project.h"
2025-01-13 11:09:58 +03:00
# include "params_norma.h"
2024-12-27 10:50:32 +03:00
# define COUNT_DETECT_ZERO 3000
# define COUNT_ARR_ADC_BUF_FAST_POINT 10
# define DELTA_ACP_TEMPER 0.0 // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> pt100 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 0.0 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> , <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> SG3013
# define ADC_READ_FROM_PARALLEL_BUS 1
# define DEFAULT_ZERO_ADC 2048
# ifndef USE_INTERNAL_ADC
# define USE_INTERNAL_ADC 0
# endif
# if (USE_INTERNAL_ADC==1)
# define COUNT_ARR_ADC_BUF (C_adc_number+1)
# else
# define COUNT_ARR_ADC_BUF C_adc_number
# endif
# define COUNT_ARR_ADC_BUF_EXTERNAL C_adc_number
// 23550.3
# if(C_adc_number>=1)
# define R_ADC_DEFAULT_0 { 271, 271, 876, 876, 876, 876, 876, 876, 249, 249, 301, 301, 301, 301, 301, 301 }
# define K_LEM_ADC_DEFAULT_0 { 7200, 7200, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 8400, 8400, 8400, 8400, 5000, 5000 }
# define NORMA_ADC_DEFAULT_0 { NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP }
# endif
# if(C_adc_number>=2)
# define R_ADC_DEFAULT_1 { 1, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190 }
# define K_LEM_ADC_DEFAULT_1 { 1, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1 }
# define NORMA_ADC_DEFAULT_1 { NORMA_ACP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_TEMPER_MILL_AMP, NORMA_ACP_P, NORMA_ACP }
# endif
# if(C_adc_number>=3)
# define R_ADC_DEFAULT_2 { 271, 271, 887, 887, 887, 887, 887, 887, 250, 250, 3125, 3125, 3125, 3125, 309, 309 }
# define K_LEM_ADC_DEFAULT_2 { 7200, 7200, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 60000, 60000, 60000, 60000, 5000, 5000 }
# define NORMA_ADC_DEFAULT_2 { NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP }
# endif
// 23550.1
//#if(C_adc_number>=1)
//#define R_ADC_DEFAULT_0 { 271, 271, 887, 887, 887, 887, 887, 887, 250, 250, 312, 312, 312, 312, 309, 309 }
//#define K_LEM_ADC_DEFAULT_0 { 7200, 7200, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 8400, 8400, 8400, 8400, 5000, 5000 }
//#define NORMA_ADC_DEFAULT_0 { NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP }
//#endif
//
//#if(C_adc_number>=2)
//#define R_ADC_DEFAULT_1 { 1, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190, 6190 }
//#define K_LEM_ADC_DEFAULT_1 { 1, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1 }
//#define NORMA_ADC_DEFAULT_1 { NORMA_ACP, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_TEMPER, NORMA_ACP_P, NORMA_ACP }
//#endif
//
//#if(C_adc_number>=3)
//#define R_ADC_DEFAULT_2 { 271, 271, 887, 887, 887, 887, 887, 887, 250, 250, 3125, 3125, 3125, 3125, 309, 309 }
//#define K_LEM_ADC_DEFAULT_2 { 7200, 7200, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 60000, 60000, 60000, 60000, 5000, 5000 }
//#define NORMA_ADC_DEFAULT_2 { NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP }
//#endif
# if (USE_INTERNAL_ADC==1)
# define R_ADC_DEFAULT_INTERNAL { 100,100,100,100,100,100,100,100,1248,1248,1248,100,100,100,100,100 }
# define K_LEM_ADC_DEFAULT_INTERNAL { 30,30,30,30,10,10,10,10,621,621,621,100,10,10,10,10 }
# define NORMA_ADC_DEFAULT_INTERNAL { NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP, NORMA_ACP }
# endif
/*
//awa3
//14 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> out1
2025-01-13 11:09:58 +03:00
0 - 11 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2024-12-27 10:50:32 +03:00
//15 <20> <> <EFBFBD> <EFBFBD> <EFBFBD> out2
2025-01-13 11:09:58 +03:00
0 - 11 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2024-12-27 10:50:32 +03:00
//8 <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
2025-01-13 11:09:58 +03:00
0 - 20 <EFBFBD> <EFBFBD> | 0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - 200 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2024-12-27 10:50:32 +03:00
0 V - 1.5 V / 0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - 200 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
//9 <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
2025-01-13 11:09:58 +03:00
0 - 20 <EFBFBD> <EFBFBD> | 0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - 200 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2024-12-27 10:50:32 +03:00
0 V - 1.5 V / 0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - 200 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
//10 <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
2025-01-13 11:09:58 +03:00
0 - 20 <EFBFBD> <EFBFBD> | 0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - 200 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2024-12-27 10:50:32 +03:00
0 V - 1.5 V / 0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - 200 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
//11 <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
2025-01-13 11:09:58 +03:00
0 - 20 <EFBFBD> <EFBFBD> | 0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - 200 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2024-12-27 10:50:32 +03:00
0 V - 1.5 V / 0 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - 200 <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
//12 <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
2025-01-13 11:09:58 +03:00
4 - 20 <EFBFBD> <EFBFBD> | 0 <EFBFBD> <EFBFBD> <EFBFBD> - 10 <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2024-12-27 10:50:32 +03:00
0.3 V - 1.5 V / 0 <EFBFBD> <EFBFBD> <EFBFBD> - 10 <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
//13 <20> <> <EFBFBD> <EFBFBD> <EFBFBD>
2025-01-13 11:09:58 +03:00
4 - 20 <EFBFBD> <EFBFBD> | 0 <EFBFBD> <EFBFBD> <EFBFBD> - 10 <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
2024-12-27 10:50:32 +03:00
0.3 V - 1.5 V / 0 <EFBFBD> <EFBFBD> <EFBFBD> - 10 <EFBFBD> <EFBFBD> <EFBFBD> / <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
*/
typedef union
{
2025-01-13 11:09:58 +03:00
2024-12-27 10:50:32 +03:00
struct
2025-01-13 11:09:58 +03:00
{
unsigned int c0_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c1_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c2_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c3_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c4_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c5_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c6_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c7_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c8_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c9_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c10_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c11_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c12_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c13_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c14_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
unsigned int c15_plus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> + */
2024-12-27 10:50:32 +03:00
} bit ; /* <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> */
unsigned long all ; /* <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> */
2025-01-13 11:09:58 +03:00
2024-12-27 10:50:32 +03:00
} ERR_ADC_PLUS_PROTECT ;
typedef union
{
2025-01-13 11:09:58 +03:00
2024-12-27 10:50:32 +03:00
struct
2025-01-13 11:09:58 +03:00
{
unsigned int c0_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c1_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c2_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c3_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c4_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c5_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c6_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c7_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c8_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c9_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c10_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c11_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c12_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c13_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c14_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
unsigned int c15_minus : 1 ; /* 0 <09> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> - */
2024-12-27 10:50:32 +03:00
} bit ; /* <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> */
unsigned int all ; /* <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> */
2025-01-13 11:09:58 +03:00
2024-12-27 10:50:32 +03:00
} ERR_ADC_MINUS_PROTECT ;
typedef struct
{
2025-01-13 11:09:58 +03:00
ERR_ADC_PLUS_PROTECT plus ;
ERR_ADC_MINUS_PROTECT minus ;
2024-12-27 10:50:32 +03:00
} ERR_ADC_PROTECT ;
/* <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> y <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> y<EFBFBD> <79> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> */
typedef struct
{
2025-01-13 11:09:58 +03:00
_iq iqU_1 ;
2024-12-27 10:50:32 +03:00
_iq iqU_2 ;
2025-01-13 11:09:58 +03:00
_iq iqU_1_fast ;
_iq iqU_2_fast ;
2024-12-27 10:50:32 +03:00
_iq iqU_1_long ;
2025-01-13 11:09:58 +03:00
_iq iqU_2_long ;
2024-12-27 10:50:32 +03:00
_iq iqIu_1 ;
_iq iqIv_1 ;
_iq iqIw_1 ;
_iq iqIu_2 ;
_iq iqIv_2 ;
_iq iqIw_2 ;
2025-01-13 11:09:58 +03:00
_iq iqIu_1_rms ;
_iq iqIv_1_rms ;
_iq iqIw_1_rms ;
2024-12-27 10:50:32 +03:00
2025-01-13 11:09:58 +03:00
_iq iqIu_2_rms ;
_iq iqIv_2_rms ;
_iq iqIw_2_rms ;
2024-12-27 10:50:32 +03:00
2025-01-13 11:09:58 +03:00
_iq iqIu ;
_iq iqIv ;
_iq iqIw ;
2024-12-27 10:50:32 +03:00
_iq iqIin_1 ;
_iq iqIin_2 ;
_iq iqUin_A1B1 ;
_iq iqUin_B1C1 ;
_iq iqUin_C1A1 ;
_iq iqUin_A2B2 ;
_iq iqUin_B2C2 ;
_iq iqUin_C2A2 ;
_iq iqUin_A1B1_rms ;
2025-01-13 11:09:58 +03:00
_iq iqUin_B1C1_rms ;
_iq iqUin_C1A1_rms ;
2024-12-27 10:50:32 +03:00
2025-01-13 11:09:58 +03:00
_iq iqUin_A2B2_rms ;
_iq iqUin_B2C2_rms ;
_iq iqUin_C2A2_rms ;
2024-12-27 10:50:32 +03:00
_iq iqUin_m1 ;
_iq iqUin_m2 ;
2025-01-13 11:09:58 +03:00
_iq iqIbreak_1 ;
_iq iqIbreak_2 ; //39
2024-12-27 10:50:32 +03:00
_iq T_U01 ;
_iq T_U02 ;
_iq T_U03 ;
_iq T_U04 ;
_iq T_U05 ;
_iq T_U06 ;
_iq T_U07 ;
_iq T_Water_external ;
_iq T_Water_internal ;
2025-01-13 11:09:58 +03:00
_iq T_Air_01 ;
_iq T_Air_02 ;
_iq T_Air_03 ;
_iq T_Air_04 ;
2024-12-27 10:50:32 +03:00
2025-01-13 11:09:58 +03:00
_iq P_Water_internal ; //53
2024-12-27 10:50:32 +03:00
_iq iqI_vozbud ;
_iq iqIin_sum ;
2025-01-13 11:09:58 +03:00
_iq iqIm_1 ;
2024-12-27 10:50:32 +03:00
_iq iqIm_2 ;
_iq iqIm ;
2025-01-13 11:09:58 +03:00
2024-12-27 10:50:32 +03:00
_iq iqM ;
2025-01-13 11:09:58 +03:00
2024-12-27 10:50:32 +03:00
_iq PowerScalar ;
_iq PowerScalarFilter2 ;
_iq PowerFOC ;
2025-01-13 11:09:58 +03:00
_iq iqU_1_imit ; //63
2024-12-27 10:50:32 +03:00
/*
_iq iqUzpt_1_2 ; //uzpt1 bs2
_iq iqUzpt_2_2 ; //uzpt2 bs2
_iq iqUzpt_1_2_fast ; //uzpt1 bs2
_iq iqUzpt_2_2_fast ; //uzpt2 bs2
_iq iqUzpt_1_2_long ; //uzpt1 bs2
_iq iqUzpt_2_2_long ; //uzpt2 bs2
_iq iqIin_1_1 ; //Iin AF1 BS1
_iq iqIin_2_1 ; //Iin AF2 BS1
_iq iqIin_3_1 ; //Iin AF3 BS1
_iq iqIin_4_1 ; //Iin AF4 BS1
_iq iqIin_5_1 ; //Iin AF5 BS1
_iq iqIin_6_1 ; //Iin AF6 BS1
_iq iqIin_1_2 ; //Iin AF1 BS2
_iq iqIin_2_2 ; //Iin AF2 BS2
_iq iqIin_3_2 ; //Iin AF3 BS2
_iq iqIin_4_2 ; //Iin AF4 BS2
_iq iqIin_5_2 ; //Iin AF5 BS2
_iq iqIin_6_2 ; //Iin AF6 BS2
2025-01-13 11:09:58 +03:00
_iq iqUin_AB ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> AB
2024-12-27 10:50:32 +03:00
_iq iqUin_BC ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> BC
_iq iqUin_CA ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> CA
2025-01-13 11:09:58 +03:00
_iq iqUin_AB_sf ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> AB
2024-12-27 10:50:32 +03:00
_iq iqUin_BC_sf ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> BC
_iq iqUin_CA_sf ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> CA
2025-01-13 11:09:58 +03:00
_iq iqT_WATER_in ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <>
2024-12-27 10:50:32 +03:00
_iq iqT_WATER_out ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <>
_iq iqT_AIR_in_up ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> (<28> <> <EFBFBD> <EFBFBD> )
_iq iqT_AIR_in_down ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> (<28> <> <EFBFBD> )
_iq iqP_WATER_in ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <>
_iq iqP_WATER_out ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <>
_iq iqT_BK1_BK12 ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> BK1_BK12
_iq iqT_BK13_BK24 ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> BK13_BK24
_iq iqUin_m1 ; //<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
_iq iqIu_1_1 ; //Iu AF1 BS1
_iq iqIu_1_2 ; //Iu AF2 BS1
_iq iqIv_1_1 ; //Iv AF3 BS1
_iq iqIv_1_2 ; //Iv AF4 BS1
_iq iqIw_1_1 ; //Iw AF5 BS1
_iq iqIw_1_2 ; //Iw AF6 BS1
_iq iqIu_2_1 ; //Iu AF1 BS2
_iq iqIu_2_2 ; //Iu AF2 BS2
_iq iqIv_2_1 ; //Iv AF3 BS2
_iq iqIv_2_2 ; //Iv AF4 BS2
_iq iqIw_2_1 ; //Iw AF5 BS2
_iq iqIw_2_2 ; //Iw AF6 BS2
_iq iqIm_1 ;
_iq iqIm_2 ;
_iq iqWexp ;
_iq iqWout ;
_iq iqM ;
*/
} ANALOG_VALUE ;
# define ANALOG_VALUE_DEFAULT {0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,\
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
/* <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> y <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> y<EFBFBD> <79> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> */
# define ERR_LEVEL_ADC_PLUS 3950 //+1270A //2950 // +650A //3467 // 3367 //3367 //3267 // 0xfff-0x29c
# define ERR_LEVEL_ADC_MINUS 150 //-1270A //1150 //-650A // 267 //367
# define ERR_LEVEL_ADC_PLUS_6 3800 //3783 //3623~1150 // 3462 ~ 1050 A // 3320 ~ 960A //3680 //3267 // 0xfff-0x29c
# define ERR_LEVEL_ADC_MINUS_6 1000 //267 //367
# define MIN_DETECT_UD_ZERO 2300
# define level_err_ADC_PLUS_default {ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,ERR_LEVEL_ADC_PLUS,\
ERR_LEVEL_ADC_PLUS , ERR_LEVEL_ADC_PLUS , ERR_LEVEL_ADC_PLUS , ERR_LEVEL_ADC_PLUS , \
ERR_LEVEL_ADC_PLUS , ERR_LEVEL_ADC_PLUS , ERR_LEVEL_ADC_PLUS , ERR_LEVEL_ADC_PLUS , \
ERR_LEVEL_ADC_PLUS , ERR_LEVEL_ADC_PLUS , ERR_LEVEL_ADC_PLUS , ERR_LEVEL_ADC_PLUS }
# define level_err_ADC_MINUS_default {ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,ERR_LEVEL_ADC_MINUS,\
ERR_LEVEL_ADC_MINUS , ERR_LEVEL_ADC_MINUS , ERR_LEVEL_ADC_MINUS , ERR_LEVEL_ADC_MINUS , \
ERR_LEVEL_ADC_MINUS , ERR_LEVEL_ADC_MINUS , ERR_LEVEL_ADC_MINUS , ERR_LEVEL_ADC_MINUS , \
ERR_LEVEL_ADC_MINUS , ERR_LEVEL_ADC_MINUS , ERR_LEVEL_ADC_MINUS , ERR_LEVEL_ADC_MINUS }
extern ANALOG_VALUE analog ;
extern ANALOG_VALUE filter ;
extern ANALOG_VALUE analog_zero ;
//void calc_norm_ADC(int fast);
void calc_norm_ADC_0 ( int run_norma ) ;
void calc_norm_ADC_1 ( int run_norma ) ;
void Init_Adc_Variables ( void ) ;
void norma_adc_nc ( int nc ) ;
2025-01-13 11:09:58 +03:00
2024-12-27 10:50:32 +03:00
extern int ADC_f [ COUNT_ARR_ADC_BUF ] [ 16 ] ;
extern int zero_ADC [ COUNT_ARR_ADC_BUF ] [ 16 ] ;
2025-01-13 11:09:58 +03:00
extern ERR_ADC_PROTECT err_adc_protect [ COUNT_ARR_ADC_BUF ] , mask_err_adc_protect [ COUNT_ARR_ADC_BUF ] ;
2024-12-27 10:50:32 +03:00
2025-01-13 11:09:58 +03:00
extern unsigned int R_ADC [ COUNT_ARR_ADC_BUF ] [ 16 ] ;
extern unsigned int K_LEM_ADC [ COUNT_ARR_ADC_BUF ] [ 16 ] ;
2024-12-27 10:50:32 +03:00
extern float K_NORMA_ADC [ COUNT_ARR_ADC_BUF ] [ 16 ] ;
//void norma_all_adc(void);
2025-01-13 11:09:58 +03:00
extern _iq koef_Uzpt_long_filter , koef_Uzpt_fast_filter , koef_Uin_filter , koef_Im_filter , koef_Power_filter , koef_Power_filter2 ;
2024-12-27 10:50:32 +03:00
void detect_zero_analog ( int nc ) ;
# if (USE_INTERNAL_ADC==1)
void Init_Internal_Adc ( void ) ;
# endif
# endif // end _ADC_TOOLS