fork

Dependencies:   mbed

Fork of LG by igor Apu

Committer:
igor_v
Date:
Wed Feb 03 07:19:30 2016 +0000
Revision:
21:bc8c1cec3da6
Parent:
1:f2adcae3d304
Child:
129:406995a91322
?????????? ??????? ??????????, ???????? ??? ?????? ?????????? ??????????? ?????????.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
igor_v 1:f2adcae3d304 1 #include "Global.h"
igor_v 0:8ad47e2b6f00 2
igor_v 0:8ad47e2b6f00 3 #define debug
igor_v 0:8ad47e2b6f00 4 #define TEMP_AVER_PERIOD 4 // e. number of seconds for average
igor_v 21:bc8c1cec3da6 5 int TermoCompens_Sum = 0;
igor_v 0:8ad47e2b6f00 6 unsigned int IsHeating;
igor_v 21:bc8c1cec3da6 7 //int Tmp_Out[NUM_OF_THERMOSENS];
igor_v 21:bc8c1cec3da6 8 int dThermoHeatDeltaPer_dTermo[TERMO_FUNC_SIZE];
igor_v 21:bc8c1cec3da6 9 int dThermoCoolDeltaPer_dTermo[TERMO_FUNC_SIZE];
igor_v 21:bc8c1cec3da6 10 int dFuncPer_dTermo[TERMO_FUNC_SIZE];
igor_v 21:bc8c1cec3da6 11 int TermoCompDelta;
igor_v 21:bc8c1cec3da6 12 int Temp_Aver; //e. the mean temperature for 1 Sec for T4 sensor //r. средняя температура за 1 секунду для датчика T4
igor_v 21:bc8c1cec3da6 13 int TempEvolution = 0;
igor_v 21:bc8c1cec3da6 14 int StartTermoCompens = 0; //e. initial thermocompensation (in XXX seconds after start ) //r. начальная термокомпенсация (через ХХХ секунд после старта)
igor_v 0:8ad47e2b6f00 15
igor_v 21:bc8c1cec3da6 16 extern int WP_reset_heating; //e. voltage of reset at heating //r. напряжение сброса при нагревании
igor_v 21:bc8c1cec3da6 17 extern int WP_reset_cooling; //e. voltage of reset at cooling //r. напряжение сброса при охлаждении
igor_v 0:8ad47e2b6f00 18
igor_v 0:8ad47e2b6f00 19 __inline Max_Saturation(unsigned *lvl, unsigned limit)
igor_v 0:8ad47e2b6f00 20 {
igor_v 21:bc8c1cec3da6 21 if (*lvl>limit) *lvl = limit;
igor_v 0:8ad47e2b6f00 22 }
igor_v 0:8ad47e2b6f00 23
igor_v 0:8ad47e2b6f00 24 /*{
igor_v 21:bc8c1cec3da6 25 switch (Device_blk.Str.TermoMode) //e. selecting thermocompensation mode //r. выбор режима термокомпенсации
igor_v 0:8ad47e2b6f00 26 {
igor_v 0:8ad47e2b6f00 27 case TERMO_ON:
igor_v 0:8ad47e2b6f00 28 case TERMO_ON_NUMB_OFF:
igor_v 0:8ad47e2b6f00 29
igor_v 21:bc8c1cec3da6 30 TermoCompens_Sum += StartTermoCompens + DynamicDeltaCalc(); //e. accumulation of the value of thermocompensation from request to request //r. накопление величины термокомпенсации от запроса до запроса
igor_v 0:8ad47e2b6f00 31
igor_v 0:8ad47e2b6f00 32 break;
igor_v 21:bc8c1cec3da6 33
igor_v 0:8ad47e2b6f00 34 case TERMO_ON_STATIC_ONLY:
igor_v 0:8ad47e2b6f00 35 case TERMO_ON_STATIC_ONLY_NUMB_OFF:
igor_v 0:8ad47e2b6f00 36 #if !defined debug_SOI
igor_v 21:bc8c1cec3da6 37 TermoCompens_Sum += StartTermoCompens; //e. accumulation of the value of thermocompensation from request to request //r. накопление величины термокомпенсации от запроса до запроса
igor_v 0:8ad47e2b6f00 38 #endif
igor_v 0:8ad47e2b6f00 39 break;
igor_v 21:bc8c1cec3da6 40
igor_v 0:8ad47e2b6f00 41 case TERMO_ON_DYNAMIC_ONLY:
igor_v 0:8ad47e2b6f00 42 case TERMO_ON_DYNAMIC_ONLY_NUMB_OFF:
igor_v 0:8ad47e2b6f00 43 #if !defined debug_SOI
igor_v 21:bc8c1cec3da6 44 TermoCompens_Sum += DynamicTermoCompens(); //e. accumulation of the value of thermocompensation from request to request //r. накопление величины термокомпенсации от запроса до запроса
igor_v 0:8ad47e2b6f00 45 #endif
igor_v 0:8ad47e2b6f00 46 break;
igor_v 21:bc8c1cec3da6 47
igor_v 0:8ad47e2b6f00 48 case TERMO_OFF:
igor_v 0:8ad47e2b6f00 49 default:
igor_v 21:bc8c1cec3da6 50 TermoCompens_Sum = 0; //e. thermocompensation is disable, therefore its part is equal to zero //r. термокомпенсация выключена, поэтому ее вклад равен нулю
igor_v 0:8ad47e2b6f00 51
igor_v 0:8ad47e2b6f00 52 } //of thermomode switch
igor_v 0:8ad47e2b6f00 53 } */
igor_v 0:8ad47e2b6f00 54 /******************************************************************************
igor_v 0:8ad47e2b6f00 55 ** Function name: StaticTermoCompens
igor_v 0:8ad47e2b6f00 56 **
igor_v 21:bc8c1cec3da6 57 ** Descriptions: Procedure of
igor_v 0:8ad47e2b6f00 58 **
igor_v 21:bc8c1cec3da6 59 ** parameters: None
igor_v 21:bc8c1cec3da6 60 ** Returned value: None
igor_v 21:bc8c1cec3da6 61 **
igor_v 0:8ad47e2b6f00 62 ******************************************************************************/
igor_v 21:bc8c1cec3da6 63 int StaticTermoCompens(int temperature) //r. расчет статической составляющей термокомпенсации за один период прибора (100 мкс)
igor_v 0:8ad47e2b6f00 64 {
igor_v 0:8ad47e2b6f00 65
igor_v 21:bc8c1cec3da6 66 float TermoCompens_Curr; //r. величина термокомпенсации за один период прибора (100 мкс)
igor_v 21:bc8c1cec3da6 67
igor_v 21:bc8c1cec3da6 68 int i, t;
igor_v 0:8ad47e2b6f00 69
igor_v 21:bc8c1cec3da6 70 //r. используем только термодатчик TSENS_NUMB
igor_v 21:bc8c1cec3da6 71 //r. для новых термодатчиков: T4, для старых: T1
igor_v 21:bc8c1cec3da6 72 //r. и используем кусочно-непрерывную термокомпенсацию
igor_v 21:bc8c1cec3da6 73
igor_v 21:bc8c1cec3da6 74 //r. Tmp_Out[TSENS_NUMB] = 8960; //-2560; //5120; //8000; // -2600; //-5000;
igor_v 21:bc8c1cec3da6 75
igor_v 21:bc8c1cec3da6 76 t = temperature;
igor_v 21:bc8c1cec3da6 77 if(t > Device_blk.Str.TemperInt[TERMO_FUNC_SIZE - 1]) {
igor_v 21:bc8c1cec3da6 78 t = Device_blk.Str.TemperInt[TERMO_FUNC_SIZE - 1];
igor_v 21:bc8c1cec3da6 79 }
igor_v 0:8ad47e2b6f00 80
igor_v 21:bc8c1cec3da6 81 i = 0;
igor_v 21:bc8c1cec3da6 82 while( t > Device_blk.Str.TemperInt[i] ) i++;
igor_v 0:8ad47e2b6f00 83
igor_v 21:bc8c1cec3da6 84 //r. Tmp_Out[5] = i;
igor_v 21:bc8c1cec3da6 85 TermoCompens_Curr = Device_blk.Str.TermoFunc[i] - dFuncPer_dTermo[i] * (float)( Device_blk.Str.TemperInt[i] - t );
igor_v 0:8ad47e2b6f00 86
igor_v 21:bc8c1cec3da6 87 //r. Отладка
igor_v 21:bc8c1cec3da6 88 //r. TermoCompens_Curr = 1.111111125; // отладка
igor_v 21:bc8c1cec3da6 89 //r.TermoCompens_Curr = // 0.25; // за 1 сек накапливается 2500 импульсов
igor_v 21:bc8c1cec3da6 90 /*r.
igor_v 21:bc8c1cec3da6 91 //0.000100; // коэфф., при котором за 1 сек накапливается 1 импульс
igor_v 21:bc8c1cec3da6 92 //1.0001; // коэфф., при котором за 1 сек накапливается 10001 импульс
igor_v 21:bc8c1cec3da6 93 // 0.000125; // коэфф., при котором за 1 сек накапливается 1.25 импульса (за 100 выводится 122 имп.???)
igor_v 21:bc8c1cec3da6 94 // 0.000105; // за 100 сек д.накапливаться 105 имп., накапл. 103???
igor_v 21:bc8c1cec3da6 95 */
igor_v 0:8ad47e2b6f00 96
igor_v 21:bc8c1cec3da6 97 // TermoCompens_Curr = LONG_2_FRACT_14_18(TermoCompens_Curr); //r. TermoCompens_Curr переводим в формат 14.18
igor_v 0:8ad47e2b6f00 98
igor_v 21:bc8c1cec3da6 99 return TermoCompens_Curr;
igor_v 0:8ad47e2b6f00 100 } // StaticTermoCompens
igor_v 0:8ad47e2b6f00 101
igor_v 0:8ad47e2b6f00 102 /******************************************************************************
igor_v 0:8ad47e2b6f00 103 ** Function name: DynamicDeltaCalc
igor_v 0:8ad47e2b6f00 104 **
igor_v 21:bc8c1cec3da6 105 ** Descriptions: Procedure of
igor_v 0:8ad47e2b6f00 106 **
igor_v 21:bc8c1cec3da6 107 ** parameters: None
igor_v 21:bc8c1cec3da6 108 ** Returned value: Thermocompensation addition
igor_v 21:bc8c1cec3da6 109 **
igor_v 0:8ad47e2b6f00 110 ******************************************************************************/
igor_v 21:bc8c1cec3da6 111 int DynamicDeltaCalc() //e. calculation the addition termocompensation for 1 reset //r. расчет добавки термокомпенсации на одно обнуление
igor_v 0:8ad47e2b6f00 112 {
igor_v 0:8ad47e2b6f00 113
igor_v 21:bc8c1cec3da6 114 int i, t;
igor_v 21:bc8c1cec3da6 115
igor_v 21:bc8c1cec3da6 116 t = Temp_Aver;
igor_v 0:8ad47e2b6f00 117
igor_v 21:bc8c1cec3da6 118 if (IsHeating) {
igor_v 21:bc8c1cec3da6 119 if(t > Device_blk.Str.TemperIntDyn[TERMO_FUNC_SIZE - 1]) {
igor_v 21:bc8c1cec3da6 120 t = Device_blk.Str.TemperIntDyn[TERMO_FUNC_SIZE - 1];
igor_v 21:bc8c1cec3da6 121 }
igor_v 21:bc8c1cec3da6 122
igor_v 21:bc8c1cec3da6 123 i = 0;
igor_v 21:bc8c1cec3da6 124 while( t > Device_blk.Str.TemperIntDyn[i] ) i++;
igor_v 0:8ad47e2b6f00 125
igor_v 21:bc8c1cec3da6 126 TermoCompDelta = ( Device_blk.Str.ThermoHeatDelta[i] - dThermoHeatDeltaPer_dTermo[i] * (float)( Device_blk.Str.TemperIntDyn[i] - t ) );
igor_v 21:bc8c1cec3da6 127 } else {
igor_v 21:bc8c1cec3da6 128 if(t > Device_blk.Str.TemperCoolIntDyn[TERMO_FUNC_SIZE - 1]) {
igor_v 21:bc8c1cec3da6 129 t = Device_blk.Str.TemperCoolIntDyn[TERMO_FUNC_SIZE - 1];
igor_v 21:bc8c1cec3da6 130 }
igor_v 21:bc8c1cec3da6 131
igor_v 21:bc8c1cec3da6 132 i = 0;
igor_v 21:bc8c1cec3da6 133 while( t > Device_blk.Str.TemperCoolIntDyn[i] ) i++;
igor_v 21:bc8c1cec3da6 134
igor_v 21:bc8c1cec3da6 135 TermoCompDelta = ( Device_blk.Str.ThermoCoolDelta[i] - dThermoCoolDeltaPer_dTermo[i] * (float)( Device_blk.Str.TemperCoolIntDyn[i] - t ) );
igor_v 0:8ad47e2b6f00 136 }
igor_v 21:bc8c1cec3da6 137 return TermoCompDelta;
igor_v 0:8ad47e2b6f00 138
igor_v 0:8ad47e2b6f00 139 } // DynamicDeltaCalc
igor_v 0:8ad47e2b6f00 140
igor_v 0:8ad47e2b6f00 141 /******************************************************************************
igor_v 0:8ad47e2b6f00 142 ** Function name: clc_ThermoSensors
igor_v 0:8ad47e2b6f00 143 **
igor_v 21:bc8c1cec3da6 144 ** Descriptions: Procedure of calculating of the normalized temperaturre vector
igor_v 0:8ad47e2b6f00 145 **
igor_v 21:bc8c1cec3da6 146 ** parameters: None
igor_v 21:bc8c1cec3da6 147 ** Returned value: None
igor_v 21:bc8c1cec3da6 148 **
igor_v 0:8ad47e2b6f00 149 ******************************************************************************/
igor_v 21:bc8c1cec3da6 150 void clc_ThermoSensors(void)
igor_v 0:8ad47e2b6f00 151 {
igor_v 21:bc8c1cec3da6 152 unsigned i;
igor_v 21:bc8c1cec3da6 153 static int TS_sum = 0;
igor_v 21:bc8c1cec3da6 154 static int seconds_aver = 0, TenSeconds = 0;
igor_v 21:bc8c1cec3da6 155 static int Temp_AverPrevDynCalc = -7000;
igor_v 21:bc8c1cec3da6 156 static int StartRdy = 1;
igor_v 21:bc8c1cec3da6 157 static int PrevTemp = -7000;
igor_v 0:8ad47e2b6f00 158
igor_v 21:bc8c1cec3da6 159 for (i=0; i<2; i++) {
igor_v 21:bc8c1cec3da6 160 //e. conversion of temperature values on ADC output //r. преобразование значений температуры на выходе АЦП
igor_v 21:bc8c1cec3da6 161 //e. to range -32768 .. +32767 ( additional code; format 1.15 ) //r. к диапазону -32768 .. +32767 (дополнит. код; формат 1.15)
igor_v 21:bc8c1cec3da6 162 /* Output.Str.Tmp_Out[i] = mac_r(Device_blk.Str.Tmp_bias[i] << 16,
igor_v 21:bc8c1cec3da6 163 (Input.StrIn.Tmp_in[i] - 0x8000),
igor_v 21:bc8c1cec3da6 164 Device_blk.Str.Tmp_scal[i]);*/
igor_v 21:bc8c1cec3da6 165 Output.Str.Tmp_Out[i+4] = Input.StrIn.Tmp_in[i];
igor_v 21:bc8c1cec3da6 166 }
igor_v 0:8ad47e2b6f00 167
igor_v 21:bc8c1cec3da6 168 if (time_1_Sec == DEVICE_SAMPLE_RATE_uks) { //r. истекла 1 секунда
igor_v 21:bc8c1cec3da6 169 seconds_aver++;
igor_v 21:bc8c1cec3da6 170 }
igor_v 0:8ad47e2b6f00 171
igor_v 21:bc8c1cec3da6 172 if (seconds_aver > TEMP_AVER_PERIOD) { //r. истекли TEMP_AVER_PERIOD(4 секунды) секунд
igor_v 21:bc8c1cec3da6 173 seconds_aver = 0;
igor_v 21:bc8c1cec3da6 174 TenSeconds++;
igor_v 21:bc8c1cec3da6 175 PrevTemp = Temp_Aver; //e. save the previous mean temperature for 1 Sec //r. запоминаем предыдущую среднюю температуру за секунду
igor_v 21:bc8c1cec3da6 176 Temp_Aver = TS_sum / (DEVICE_SAMPLE_RATE_HZ * TEMP_AVER_PERIOD); //e. calculating mean temperature for 1 Sec //r. вычисляем среднюю температуру за секунду
igor_v 0:8ad47e2b6f00 177
igor_v 21:bc8c1cec3da6 178 if (Temp_Aver > PrevTemp) {
igor_v 21:bc8c1cec3da6 179 TempEvolution++;
igor_v 21:bc8c1cec3da6 180 }
igor_v 21:bc8c1cec3da6 181 if (Temp_Aver < PrevTemp) {
igor_v 21:bc8c1cec3da6 182 TempEvolution--;
igor_v 21:bc8c1cec3da6 183 }
igor_v 21:bc8c1cec3da6 184
igor_v 21:bc8c1cec3da6 185 TS_sum = 0; //e. reset the sum for calculation of an mean //r. обнуляем сумму для вычисления среднего
igor_v 21:bc8c1cec3da6 186 } else {
igor_v 21:bc8c1cec3da6 187 TS_sum += Output.Str.Tmp_Out[TSENS_NUMB];
igor_v 21:bc8c1cec3da6 188 }
igor_v 0:8ad47e2b6f00 189
igor_v 21:bc8c1cec3da6 190 if (TenSeconds == 10) { // 10 * TEMP_AVER_PERIOD = 40
igor_v 21:bc8c1cec3da6 191 TenSeconds = 0;
igor_v 21:bc8c1cec3da6 192 if (TempEvolution > 0) {
igor_v 21:bc8c1cec3da6 193 IsHeating = 1;
igor_v 21:bc8c1cec3da6 194 }
igor_v 21:bc8c1cec3da6 195
igor_v 21:bc8c1cec3da6 196 if (TempEvolution < 0) {
igor_v 21:bc8c1cec3da6 197 IsHeating = 0;
igor_v 21:bc8c1cec3da6 198 }
igor_v 21:bc8c1cec3da6 199 TempEvolution = 0;
igor_v 21:bc8c1cec3da6 200 }
igor_v 0:8ad47e2b6f00 201
igor_v 21:bc8c1cec3da6 202 //e. single calculaiton of some device parameters (measurement on the VALID_START_SEC second after start) //r. однократный расчет некоторых параметров прибора (измерение на VALID_START_SEC секунде после старта)
igor_v 21:bc8c1cec3da6 203 if (StartRdy) {
igor_v 21:bc8c1cec3da6 204 if (TenSeconds > VALID_START_4SEC) {
igor_v 21:bc8c1cec3da6 205
igor_v 21:bc8c1cec3da6 206 StartRdy = 0; //r. самоблокировка, поэтому больше сюда не заходим
igor_v 21:bc8c1cec3da6 207
igor_v 21:bc8c1cec3da6 208 if ((Device_blk.Str.TermoMode != TERMO_OFF) && \
igor_v 21:bc8c1cec3da6 209 (Device_blk.Str.TermoMode != TERMO_ON_DYNAMIC_ONLY) && \
igor_v 21:bc8c1cec3da6 210 (Device_blk.Str.TermoMode != TERMO_ON_DYNAMIC_ONLY_NUMB_OFF)) { //r. статическая термокомпенсация включена
igor_v 21:bc8c1cec3da6 211 //r. расчет статической термокомпенсации числа
igor_v 21:bc8c1cec3da6 212 StartTermoCompens = StaticTermoCompens(Temp_Aver); //r. стартовая температуры прибора
igor_v 21:bc8c1cec3da6 213 }
igor_v 21:bc8c1cec3da6 214 DynamicDeltaCalc();
igor_v 0:8ad47e2b6f00 215
igor_v 21:bc8c1cec3da6 216 //r. расчет границ для частоты вибропривода, зависящего от стартовой температуры
igor_v 21:bc8c1cec3da6 217 // DithFreqRangeCalc();
igor_v 21:bc8c1cec3da6 218
igor_v 21:bc8c1cec3da6 219 //r. коэффициенты для полосового фильтра квази ДУП не пересчитываем: считаем, что полоса фильтра заведомо шире
igor_v 21:bc8c1cec3da6 220
igor_v 0:8ad47e2b6f00 221
igor_v 21:bc8c1cec3da6 222 //r. напряжение сброса при нагревании
igor_v 21:bc8c1cec3da6 223 WP_reset_heating = CPL_reset_calc(Device_blk.Str.WP_reset, Device_blk.Str.K_WP_rst_heating, Temp_Aver, Device_blk.Str.TemperNormal);
igor_v 21:bc8c1cec3da6 224 //e. voltage of reset at cooling //r. напряжение сброса при охлаждении
igor_v 21:bc8c1cec3da6 225 WP_reset_cooling = CPL_reset_calc(Device_blk.Str.WP_reset2, Device_blk.Str.K_WP_rst_cooling, Temp_Aver, Device_blk.Str.TemperNormal);
igor_v 21:bc8c1cec3da6 226 }
igor_v 21:bc8c1cec3da6 227 }
igor_v 0:8ad47e2b6f00 228
igor_v 21:bc8c1cec3da6 229 if ( abs(Temp_Aver - Temp_AverPrevDynCalc) > Device_blk.Str.DeltaTempRecalc) {
igor_v 21:bc8c1cec3da6 230 Temp_AverPrevDynCalc = Temp_Aver;
igor_v 21:bc8c1cec3da6 231 DynamicDeltaCalc();
igor_v 21:bc8c1cec3da6 232 }//r. расчет средней за 1 секунду температуры датчиков T4, T5
igor_v 0:8ad47e2b6f00 233
igor_v 21:bc8c1cec3da6 234 // cyclic built-in test
igor_v 21:bc8c1cec3da6 235 if ( (Output.Str.Tmp_Out[4] < TS_MIN) || (Output.Str.Tmp_Out[4] > TS_MAX) || (Output.Str.Tmp_Out[5] < TS_MIN) || (Output.Str.Tmp_Out[5] > TS_MAX) ) {
igor_v 21:bc8c1cec3da6 236 Valid_Data |= THERMO_RANGE_ERROR;
igor_v 21:bc8c1cec3da6 237 }
igor_v 0:8ad47e2b6f00 238
igor_v 21:bc8c1cec3da6 239 if ( abs( Output.Str.Tmp_Out[4] - Output.Str.Tmp_Out[5]) > TS_DIFF_MAX) {
igor_v 21:bc8c1cec3da6 240 Valid_Data |= THERMO_DIFF_ERROR;
igor_v 21:bc8c1cec3da6 241 }
igor_v 0:8ad47e2b6f00 242 } // clc_ThermoSensors
igor_v 0:8ad47e2b6f00 243
igor_v 0:8ad47e2b6f00 244
igor_v 0:8ad47e2b6f00 245 /******************************************************************************
igor_v 0:8ad47e2b6f00 246 ** Function name: clc_PLC
igor_v 0:8ad47e2b6f00 247 **
igor_v 21:bc8c1cec3da6 248 ** Descriptions: Procedure of initial processing for the CPLC regulator
igor_v 0:8ad47e2b6f00 249 **
igor_v 21:bc8c1cec3da6 250 ** parameters: None
igor_v 21:bc8c1cec3da6 251 ** Returned value: None
igor_v 21:bc8c1cec3da6 252 **
igor_v 0:8ad47e2b6f00 253 ******************************************************************************/
igor_v 21:bc8c1cec3da6 254 void DithFreqRangeCalc(void) //r. расчет границ коэффициента деления для частоты вибропривода, зависящих от текущей температуры
igor_v 0:8ad47e2b6f00 255 {
igor_v 0:8ad47e2b6f00 256
igor_v 21:bc8c1cec3da6 257 unsigned int min_level, max_level;
igor_v 21:bc8c1cec3da6 258 int delta_VB_N;
igor_v 21:bc8c1cec3da6 259
igor_v 21:bc8c1cec3da6 260 delta_VB_N = mult_r(Device_blk.Str.K_vb_tu >> DITH_VBN_SHIFT, (Temp_Aver - Device_blk.Str.TemperNormal)); //r.200;
igor_v 21:bc8c1cec3da6 261 //r. !!! сделать суммирование с насыщением, а затем сдвиг
igor_v 21:bc8c1cec3da6 262 min_level = VB_Nmin0 + delta_VB_N;
igor_v 21:bc8c1cec3da6 263 max_level = VB_Nmax0 + delta_VB_N;
igor_v 21:bc8c1cec3da6 264 // maximum saturation for unsigned levels
igor_v 21:bc8c1cec3da6 265 Max_Saturation(&min_level, ((unsigned int)0xFFFF >> DITH_VBN_SHIFT)-1); // min should be always less then max_level by 1
igor_v 21:bc8c1cec3da6 266 Max_Saturation(&max_level, ((unsigned int)0xFFFF >> DITH_VBN_SHIFT));
igor_v 21:bc8c1cec3da6 267 Device_blk.Str.VB_Nmin = min_level << DITH_VBN_SHIFT;
igor_v 21:bc8c1cec3da6 268 Device_blk.Str.VB_Nmax = max_level << DITH_VBN_SHIFT;
igor_v 0:8ad47e2b6f00 269
igor_v 0:8ad47e2b6f00 270 } // DithFreqRange_calc
igor_v 0:8ad47e2b6f00 271
igor_v 21:bc8c1cec3da6 272