Dmitry Kovalev
/
LG
n
Fork of LG by
Diff: host/Source/App/CntrlGLD.h~RF105d04e.TMP
- Revision:
- 23:12e6183f04d4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/host/Source/App/CntrlGLD.h~RF105d04e.TMP Wed Feb 03 10:44:42 2016 +0300 @@ -0,0 +1,325 @@ + +#ifndef DEVICE +#define DEVICE + +//e. constants for the piecewise-linear thermocompensation //r. êîíñòàíòû äëÿ êóñî÷íî-ëèíåéíîé òåðìîêîìïåíñàöèè +#define TERMO_FUNC_SIZE 14 //e. amount of the points of the table function of thermocompensation //r. êîëè÷åñòâî òî÷åê òàáëè÷íîé ôóíêöèè òåðìîêîìïåíñàöèè +#define MAX_ORDER 9 //e. maximal value of order for the thermocompensation coefficients //r. ìàêñèìàëüíàÿ âåëè÷èíà ïîðÿäêà äëÿ êîýôôèöèåíòîâ òåðìîêîìïåíñàöèè +#define TSENS_NUMB 4 //e. number of the temperature sensor used for the thermocompensation //r. íîìåð òåðìîäàò÷èêà, èñïîëüçóåìîãî äëÿ êîìïåíñàöèè + +typedef enum _TERMO_MODE //e. thermocompensation modes //r. ðåæèìû ðàáîòû òåðìîêîìïåíñàöèè +{ + TERMO_OFF, //e. thermocompensation is switched off //r. òåðìîêîìïåíñàöèÿ âûêëþ÷åíà + TERMO_ON, //e. thermocompensation is switched on //r. òåðìîêîìïåíñàöèÿ âêëþ÷åíà + TERMO_ON_NUMB_OFF, //e. thermocompensation is switched on, number resets (debug mode) //r. òåðìîêîìïåíñàöèÿ âêëþ÷åíà, ÷èñëî çàíóëÿåòñÿ (îòëàäî÷íûé ðåæèì) + TERMO_ON_STATIC_ONLY, //e. only static thermocompensation is switched on //r. âêëþ÷åíà òîëüêî ñòàòè÷åñêàÿ òåðìîêîìïåíñàöèÿ + TERMO_ON_DYNAMIC_ONLY, //e. only dynamic thermocompensation is switched on //r. âêëþ÷åíà òîëüêî äèíàìè÷åñêàÿ òåðìîêîìïåíñàöèÿ + TERMO_ON_STATIC_ONLY_NUMB_OFF, //e. static thermocompensation is switched on, number resets (debug mode) //r. ñòàòè÷åñêàÿ òåðìîêîìïåíñàöèÿâêëþ÷åíà, ÷èñëî çàíóëÿåòñÿ (îòëàäî÷íûé ðåæèì) + TERMO_ON_DYNAMIC_ONLY_NUMB_OFF //e. dynamic thermocompensation is switched on, number resets (debug mode) //r. äèíàìè÷åñêàÿ òåðìîêîìïåíñàöèÿâêëþ÷åíà, ÷èñëî çàíóëÿåòñÿ (îòëàäî÷íûé ðåæèì) +} TERMO_MODE; + +typedef enum _WATCH_MODE //e. variants of control points for scope //r. âàðèàíòû êîíòðîëüíûõ òî÷åê äëÿ îñöèëëîãðàôà +{ + VB_DELAY_MEANDER, //e. the delayed on the VB_phs meander //r. çàäåðæàííûé ìåàíäð íà âåëè÷èíó VB_phs + VB_PHASE_DETECTOR, //e. output of the PD of the dither drive //r. âûõîä ôàçîâîãî äåòåêòîðà âèþðîïðèâîäà + VB_PHASE_DETECTOR_1_SEC, //e. output of integral of the PD of the dither drive for 1 Sec //r. âûõîä èíòåãðàëà ÔÄ âèáðîïðèâîäà çà 1 ñåê + VB_INTEGRATOR_40T, //e. output of integral of the PD of the dither drive for 40 periods //r. âûõîä èíòåãðàëà ÔÄ âèáðîïðèâîäà çà 40 ïåðèîäîâ + WP_PHASE_DETECTOR //e. output of the PD of the CPLC regulator //r. âûõîä ôàçîâîãî äåòåêòîðà êîíòóðà ÑÐÏ +} WATCH_MODE; + +//e. ===== device operation modes ================================================================ //r. ===== ðåæèìû ðàáîòû ïðèáîðà ================================================================ +#define DM_INT_10KHZ_LATCH 1 //e. mode of internal latch 10 kHz //r. ðåæèì âíóòðåííåé çàùåëêè 10 êÃö +#define DM_INT_LATCH_DELTA_PS 2 +#define DM_INT_LATCH_DELTA_BINS 3 +#define DM_EXT_LATCH_DELTA_PS_PULSE 4 //e. mode of external latch with output of the Delta_PS command by pulse //r. ðåæèì âíåøíåé çàùåëêè ñ âûäà÷åé êîìàíäû Delta_PS ïî èìïóëüñó +#define DM_EXT_LATCH_DELTA_BINS_PULSE 6 //e. mode of external latch with output of the Delta_BINS command by pulse//r. ðåæèì âíåøíåé çàùåëêè ñ âûäà÷åé êîìàíäû Delta_BINS ïî èìïóëüñó +#define DM_EXT_LATCH_DELTA_SF_PULSE 7 //e. mode of Delta Scale factor //r. ðåæèì Delta_SF command + + //e. *** the BLOCK of VARIABLES, LOADED from FLASH-memory ********************** //r. *** ÁËÎÊ ÏÅÐÅÌÅÍÍÛÕ, ÇÀÃÐÓÆÀÅÌÛÕ èç FLASH-ïàìÿòè ********************** + //e. Address (parameter number in the block = 0..255 ) //r. Àäðåñ (Íîìåð ïàðàìåòðà â áëîêå = 0..255) +typedef union + { + int Array[171]; + struct + { // Device_blk + int My_Addres; //e. 0 - device own address //r.0 - ñîáñòâåííûé àäðåñ óñòðîéñòâà + + //e. =============== parameters of HFO regulator =============== //r. =============== ïàðàìåòðû êîíòóðà Â× ãåíåðàòîðà íàêà÷êè =============== + int HF_ref; //e. 1 - value of the reference //r. 1 - çíà÷åíèå îïîðû + int HF_scl; //e. 2 - the gain factor (1.15) //r. 2 - êîýôôèöèåíò ïåðåäà÷è (1.15) + int HF_min; //r. 3 - ìèíèìóì âûõîäíîãî çíà÷åíèÿ íà ÖÀÏå ðåãóëÿòîðà (ñîîòâåòñòâóåò ìàêñèì. íàïðÿæåíèþ íà ÃÂ×) + int HF_max; //e. 4 - maximum of the output value on the regulator DAC (appropriate to minimal voltage on the HFO) //r. 4 - ìàêñèìóì âûõîäíîãî çíà÷åíèÿ íà ÖÀÏå ðåãóëÿòîðà (ñîîòâåòñòâóåò ìèíèì. íàïðÿæåíèþ íà ÃÂ×) + + //e. =============== parameters of the regulator of the DS power regulator ========== //r. =============== ïàðàìåòðû êîíòóðà ðåãóëèðîâàíèÿ ìîùíîñòè ÄÓÏ ========== + int RI_ref; //e. 5 - value of the reference //r. 5 - çíà÷åíèå îïîðû + int RI_scl; //e. 6 - the gain factor (1.15) //r. 6 - êîýôôèöèåíò ïåðåäà÷è (1.15) + + //e. =============== parameters of the CPLC regulator ===== //r. =============== ïàðàìåòðû êîíòóðà ñòàáèëèçàöèè ðàáî÷åãî ïåðèìåòðà (ÑÐÏ) ===== + int WP_ref; //e. 7 - value of the reference //r. 7 - çíà÷åíèå îïîðû + int WP_scl; //e. 8 - the gain factor (1.15) //r. 8 - êîýôôèöèåíò ïåðåäà÷è (1.15) + int WP_mdy; //e. 9 - value of the reset delay //r. 9 - çíà÷åíèå çàäåðæêè ñáðîñà + int WP_rup; //e. 10 - upper value of DAC adjustment (appropriate to minimal voltage on the heater) //r. 10 - âåðõíåå çíà÷åíèå ðåãóëèðîâêè ÖÀÏ (ñîîòâåòñòâóåò ìèíèì. íàïðÿæåíèþ íà íàãðåâàòåëå) + int WP_rdw; //e. 11 - lower value of the DAC adjustment (appropriate to maximal voltage on the heater) //r. 11 - âåðõíåå çíà÷åíèå ðåãóëèðîâêè ÖÀÏ (ñîîòâåòñòâóåò ìàêñèì. íàïðÿæåíèþ íà íàãðåâàòåëå) + + //e. =============== parameters of the dither drive regulator of the GLD ==================== //r. =============== ïàðàìåòðû êîíòóðà âèáðîïðèâîäà ÃËÄ ==================== + int VB_phs; //e. 12 - the phase delay parameter of the dither drive PLL //r. 12 - ïàðàìåòð Phase_çàä. ÑÐ× âèáðîïðèâîäà + int VB_scl; //e. 13 - the gain factor (1.15) of the dither drive PLL //r. 13 - êîýôôèöèåíò ïåðåäà÷è (1.15) ÑÐ× âèáðîïðèâîäà +unsigned int VB_N; //e. 14 - divider for dither drive period (defines dither period) //r. 14 - êîýôô.äåëåíèÿ N âèáðîïðèâîäà (ïåðèîä êîëåáàíèé) ÂÏ +unsigned int VB_Nmin; //e. 15 - minimum of the output value of the oscillation period regulator //r. 15 - ìèíèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà ïåðèîäà +unsigned int VB_Nmax; //e. 16 - maximum of the output value of the oscillation period regulator //r. 16 - ìàêñèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà ïåðèîäà + + int VB_Fdf_Hi; //e. 17 - adjusted output frequency (H) //r. 17 - çàäàííàÿ ÷àñòîòà ðàñùåïëåíèÿ (H) +unsigned int VB_Fdf_Lo; //e. 18 - (L) (double precision) //r. 18 - (L) (äâîéíàÿ òî÷íîñòü) + + int VB_Fsc; //e. 19 - the gain factor of the frequency regulator //r. 19 - êîýôôèöèåíò ïåðåäà÷è ðåãóëÿòîðà ÷àñòîòû ðàñùåïëåíèÿ +unsigned int VB_Tmin; //e. 20 - the gain factor of the frequency regulator //r. 19 - êîýôôèöèåíò ïåðåäà÷è ðåãóëÿòîðà ÷àñòîòû ðàñùåïëåíèÿ +unsigned int VB_Tmax; //e. 21 - maximum of the output value of the regulator //r. 21 - ìàêñèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà Tau +unsigned int VB_tau; //e. 22 - pulse width of the dither drive (without noise)//r. 22 - äëèòåëüíîñòü èìïóëüñà âèáðîïðèâîäà (äî îøóìëåíèÿ) + int VBN_Tzd; //e. 23 - adjusted noise period //r. 23 - çàäàííûé ïåðèîä îøóìëåíèÿ + int VBN_Ran; //e. 24 - range of the random component of noise //r. 24 - äèàïàçîí ñëó÷àéíîé ñîñòàâëÿþùåé îøóìëåíèÿ VBN_Tsl + int VBN_k; //e. 25 - adjusted noise constant //r. 25 - çàäàííàÿ êîíñòàíòà îøóìëåíèÿ + + //e. =============== parameters of processing of accurate data ============= //r. =============== ïàðàìåòðû îáðàáîòêè òî÷íîñòíîé èíôîðìàöèè ============= + int PI_Fsc; //_ //e. 26 - the S_ds scale parameter //r. 26 - ìàñøòàáíûé êîýôôèöèåíò Säóï + int PI_Fb0; //_ //e. 27 - the B_ds zero shift of the DS //r. 27 - ñìåùåíèå íóëÿ ÄÓÏà Bäóï + int PI_scl; //_ //e. 28 - the Scale scale coefficient of the gyro //r. 28 - ìàñøòàáíûé êîýôô. ãèðîñêîïà Scale + int PI_bia; //_ //e. 29 - the Bias zero shift of the gyro //r. 29 - ñìåùåíèå íóëÿ ãèðîñêîïà Bias + + //e. =============== coefficients of the temperature correction ================= //r. =============== êîýôôèöèåíòû òåìïåðàòóðíîé êîððåêöèè ================= + int PI_a0; //_ // 30 + int PI_a1; //_ // 31 + int PI_a2; //_ // 32 + int PI_a3; //_ // 33 + int PI_a4; //_ // 34 + int PI_a5; //_ // 35 + int PI_a6; //_ // 36 + int PI_b1; //_ // 37 + int PI_b2; //_ // 38 + int PI_b3; //_ // 39 + int PI_b4; //_ // 40 + int PI_b5; //_ // 41 + int PI_b6; //_ // 42 + + //e. =============== parameters of normalization of the temperature sensors ============= //r. =============== ïàðàìåòðû íîðìèðîâêè äàò÷èêîâ òåìïåðàòóðû ============= + + int Tmp_bias[6]; //_ //e. 43 - an array of shifts of the 0..5 temperature sensors //r. 43 - ìàññèâ ñäâèãîâ òåìïåðàòóðíûõ äàò÷èêîâ 0..5 + int Tmp_scal[6]; //_ //e. 49 - an array of the scale coefficients of temperature sensors//r. 49 - ìàññèâ ìàñøòàáíûõ ê-òîâ òåìïåðàòóðíûõ äàò÷èêîâ + int WP_reset; //e. 55 - initial position of the CPLC regulator (after reset) //r. 55 - èñõîäíîå ïîëîæåíèå ðåãóëÿòîðà ÑÐÏ (ïîñëå ñáðîñà) + + //e. ================ gain factor of photodetector channels =========== //r. ================ ê-ò óñèëåíèÿ êàíàëîâ ôîòîïðèåìíèêà =========== +unsigned int Gain_Ph_A; //e. 56 - initial gain factor of the A channel of photodetector //r. 56 - íà÷àëüíûé ê-ò óñèëåíèÿ êàíàëà À ôîòîïðèåìíèêà +unsigned int Gain_Ph_B; //e. 57 - initial gain factor of the B channel of photodetector //r. 57 - íà÷àëüíûé ê-ò óñèëåíèÿ êàíàëà B ôîòîïðèåìíèêà + + //e. =============== switch of the source of loading GLD variables block === //r. =============== ïåðåêëþ÷àòåëü èñòî÷íèêà çàãðóçêè áëîêà ïåðåìåííûõ ÃËÄ (ãàëî÷êà â íàñòîðîå÷íîé ïðîãðàììå) + int Header_Word; //e. 58 - flash sector validity header //r. 58 - çàãîëîâîê-êëþ÷ ê èíäèêàòîðó èñòî÷íèêà çàãðóçêè + int LoadFlash_enable; //e. 59 - source loading flag: 1 - load from the flash //r. 59 - ïðèçíàê èñòî÷íèêà çàãðóçêè: 1 - ãðóçèòüñÿ èç flesh + //e. 0 - load default parameters (factory) //r. 0 - ãðóçèòü ïàðàìåòðû ïî óìîë÷àíèþ (çàâîäñêèå) +unsigned int Device_SerialNumber; //e. 60 - serial number of the device //r. 60 - ñåðèéíûé íîìåð ïðèáîðà + int Reserved0; //e. 61 - not used + TERMO_MODE TermoMode; //e 62 - device operation mode (with thermocompenstion, without it, debug )//r. 62 - ðåæèì ðàáîòû ïðèáîðà (ñ òåðìîêîìïåíñàöèåé, áåç íåå èëè îòëàäêà) +//e. addition for the piecewise-linear termocorrection //r. äîáàâëåíèå äëÿ êóñî÷íî-ëèíåéíîé òåðìîêîððåêöèè + int TemperInt[TERMO_FUNC_SIZE]; //e. 63 + float TermoFunc[TERMO_FUNC_SIZE]; //e. 77 + int WP_reset2; //e. 91 - voltages of CPLC regulator reset at cooling //r. xx - íàïðÿæåíèÿ îáíóëåíèÿ êîíòóðà ÑÐÏ ïðè îõëàæäåíèè + //e. parameters setting termocompensation parameters in dynamics (at heating and cooling) //r. ïàðàìåòðû, çàäàþùèå ïàðàìåòðû òåðìîêîìïåíñàöèè â äèíàìèêå (ïðè íàãðåâå è îõëàæäåíèè) + float Reserved1; //e. 92 - not used + float Reserved2; //e. 93 - not used + int K_vb_tu; //e. 94 - slope of dependence of the VB_N division factor from temperature (as though Hz/degree, but in relative units ) //r. êðóòèçíà çàâèñèìîñòè êîýôôèöèåíòà äåëåíèÿ VB_N îò òåìïåðàòóðû (êàê áû Ãö/ãðàäóñ, íî â ó.å.) + int TemperNormal; //e. 95 -temperature for which the VB_N division factor of the dither drive is set //r. òåìïåðàòóðà, äëÿ êîòîðîé çàäàí êîýôôèöèåíò äåëåíèÿ âèáðîïðèâîäà VB_N + int K_WP_rst_heating; //r. 96 - êðóòèçíà çàâèñèìîñòè íàïðÿæåíèÿ îáíóëåíèÿ ïðè íàãðåâàíèè îò òåìïåðàòóðû (êàê áû âîëüò/ãðàäóñ, íî â ó.å. ÖÀÏ è òåðìîäàò÷èêîâ ) + int K_WP_rst_cooling; //e. 97 - slope of dependence of a reset voltage at cooling from temperature (as though Volt/degree, but in relative units of DAC and temperature sensors) //r. êðóòèçíà çàâèñèìîñòè íàïðÿæåíèÿ îáíóëåíèÿ ïðè îõëàæäåíèè îò òåìïåðàòóðû (êàê áû âîëüò/ãðàäóñ, íî â ó.å. ÖÀÏ è òåðìîäàò÷èêîâ ) + int WP_transition_step; //e. 98 - step of change of a heater voltage at resetting //r. øàã èçìåíåíèÿ íàïðÿæåíèÿ íàãðåâàòåëÿ ïðè âûïîëíåíèè îáíóëåíèÿ + int Reserved3; // e. 99 -not used + int HF_scl_2; //r. 100 - êîýôôèöèåíò ïåðåäà÷è (1.15) êîíòóðà ÃÂ× ïðè îáíóëåíèè + int TemperIntDyn[TERMO_FUNC_SIZE]; //e. 114 - + float ThermoHeatDelta[TERMO_FUNC_SIZE]; //e. 128 - + int DeltaTempRecalc; //r. 129 - òåìïåðàòóðíûé èíòåðâàë ïåðåñ÷åòà äèíàìè÷. êîìïåíñàöèè (â ó.å.) //e. temperature delta for dynamic thermocompensation recalculation(in relative units) + int TemperCoolIntDyn[TERMO_FUNC_SIZE]; // e. 143 - + float ThermoCoolDelta[TERMO_FUNC_SIZE]; //e. 157 - + } Str; +} TDEVICE_BLK; + + + + + + + + + + + +//e. ************ end of the BLOCK of VARIABLES, LOADED from FLASH-memory ************ //r. ************ êîíåö áëîêà çàãðóæàåìûõ èç ôëýø-ïàìÿòè ïàðàìåòðîâ ÃËÄ ************ +extern TDEVICE_BLK Device_blk; //e. the BLOCK of VARIABLES, LOADED from FLASH-memory //r. ÁËÎÊ ÏÅÐÅÌÅÍÍÛÕ, ÇÀÃÐÓÆÀÅÌÛÕ èç FLASH-ïàìÿòè + +extern int Device_Mode; +extern unsigned Valid_Data; + +extern unsigned ser_num; + +extern int VB_Nmin0; //e. minimum of the output value of a regulator of the period for the Device_blk.TemperNormal temperature //r. ìèíèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà ïåðèîäà äëÿ òåìïåðàòóðû Device_blk.TemperNormal +extern int VB_Nmax0; //e. maximum of the output value of a regulator of the period for the Device_blk.TemperNormal //r. ìàêñèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà ïåðèîäà äëÿ òåìïåðàòóðû Device_blk.TemperNormal + +extern unsigned BIT_number; +extern unsigned Is_BIT; + +extern unsigned start_Rq; //e. request for device starting //r. çàïðîñ íà çàïóñê ïðèáîðà +extern unsigned stop_Rq; //e. request for device stopping //r. çàïðîñ íà îñòàíîâ ïðèáîðà +extern unsigned pulse_Rq; //e. request for light-up of laser //r. çàïðîñ íà ïîäæèã ëàçåðà + + //e. *** Default device parameters ********************** //r. *** Ïðèáîðíûå ïàðàìåòðû ïî óìîë÷àíèþ ********************** +#define DEVICE_SN 1 //e. device serial number = 01 //r. ñåðèéíûé íîìåð ïðèáîðà = 01 +#define My_Addres_const 0 //e. - device own address //r. - ñîáñòâåííûé àäðåñ óñòðîéñòâà + + //e. =============== parameters of HF regulator =============== //r. =============== ïàðàìåòðû êîíòóðà Â× ãåíåðàòîðà íàêà÷êè =============== + #define HF_REF_CONST 15080 //e. 1 - value of the reference //r. 1 - çíà÷åíèå îïîðû + #define HF_SCL_CONST 1 // 0x64 //e. 2 - the gain factor (1.15) //r. 2 - êîýôôèöèåíò ïåðåäà÷è (1.15) + #define HF_MIN_CONST -32668 //e. 3 - minimum of the output value on the regulator DAC (appropriate to maximal voltage on the HFO) //r. 3 - ìèíèìóì âûõîäíîãî çíà÷åíèÿ íà ÖÀÏå ðåãóëÿòîðà (ñîîòâåòñòâóåò ìàêñèì. íàïðÿæåíèþ íà ÃÂ×) + #define HF_MAX_CONST -17379 //e. 4 - maximum of the output value on the regulator DAC (appropriate to minimal voltage on the HFO) //r. 4 - ìàêñèìóì âûõîäíîãî çíà÷åíèÿ íà ÖÀÏå ðåãóëÿòîðà (ñîîòâåòñòâóåò ìèíèì. íàïðÿæåíèþ íà ÃÂ×) + #define HFO_SHIFT 16 //e. number of digits of fractional part in 32-bit variable of the hf_reg32 varaible //r. ÷èñëî ðàçðÿäîâ äðîáíîé ÷àñòè â 32-õáèòîâîé ïåðåìåííîé hf_reg32 + + //e. =============== parameters of the CPLC regulator ===== //r. =============== ïàðàìåòðû êîíòóðà ñòàáèëèçàöèè ðàáî÷åãî ïåðèìåòðà (ÑÐÏ) ===== + #define WP_REF_CONST 5 //e. 7 - value of the reference //r. 7 - çíà÷åíèå îïîðû + #define WP_SCL_CONST 5 //e. 8 - the gain factor (1.15) //r. 8 - êîýôôèöèåíò ïåðåäà÷è (1.15) + #define WP_MDY_CONST 30 //e. 9 - value of the reset delay //r. 9 - çíà÷åíèå çàäåðæêè ñáðîñà + #define WP_RUP_CONST 31936 //e. 10 - lower value of DAC adjustment (appropriate to minimal voltage on the heater) //r. 10 - íèæíåå çíà÷åíèå ðåãóëèðîâêè ÖÀÏ (ñîîòâåòñòâóåò ìèíèì. íàïðÿæåíèþ íà íàãðåâàòåëå) + #define WP_RDW_CONST 11801 //e. 11 - upper value of the DAC adjustment (appropriate to maximal voltage on the heater) //r. 11 - âåðõíåå çíà÷åíèå ðåãóëèðîâêè ÖÀÏ (ñîîòâåòñòâóåò ìàêñèì. íàïðÿæåíèþ íà íàãðåâàòåëå) + + + //e. =============== parameters of the dither drive regulator of the GLD ==================== //r. =============== ïàðàìåòðû êîíòóðà âèáðîïðèâîäà ÃËÄ ==================== + #define VB_PHS_CONST 4 //e. 12 - the phase delay parameter of the dither drive PLL //r. 12 - ïàðàìåòð Phase_çàä. ÑÐ× âèáðîïðèâîäà + #define VB_SCL_CONST 1024 //e. 13 - the gain factor (1.15) of the dither drive PLL //r. 13 - êîýôôèöèåíò ïåðåäà÷è (1.15) ÑÐ× âèáðîïðèâîäà + #define T_VIB_START 16600 //e. 14 - divider for dither drive period (defines dither period) //r. 14 - êîýôô.äåëåíèÿ N âèáðîïðèâîäà (ïåðèîä êîëåáàíèé) ÂÏ + //e. _VB_N - the initial value of the oscillation period of the dither drive (406Hz-18916, 17067 - 450Hz) //r. _VB_N íà÷àëüíûé ïåðèîä êîëåáàíèé âèáðîïðèâîäà (406Hz-18916, 17067 - 450Hz) + #define T_VIB_DELTA 1000 //e. the range of the oscillation period of the dither drive (~ +/- 10 Hz) //r. äèàïàçîí èçìåíåíèÿ ïåðèîäà êîëåáàíèé âèáðîïðèâîäà (~ +/- 10 Hz) + + #define VB_NMIN_CONST 12080 //e. 15 - minimum of the output value of the oscillation period regulator //r. 15 - ìèíèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà ïåðèîäà + #define VB_NMAX_CONST 64000 //e. 16 - maximum of the output value of the oscillation period regulator //r. 16 - ìàêñèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà ïåðèîäà + #define VB_FDF_HI_CONST 3 //e. 17 - adjusted output frequency (H) //r. 17 - çàäàííàÿ ÷àñòîòà ðàñùåïëåíèÿ (H) + #define VB_FDF_LO_CONST 0 //e. 18 - (L) (double precision) //r. 18 - (L) (äâîéíàÿ òî÷íîñòü) + #define VB_FSC_CONST -2000 //e. 19 - the gain factor of the output frequency regulator //r. 19 - êîýôôèöèåíò ïåðåäà÷è ðåãóëÿòîðà ÷àñòîòû ðàñùåïëåíèÿ + #define VB_TMIN_CONST 100 //e. 20 - minimum of the output value of the Tau regulator //r. 20 - ìèíèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà Tau + #define VB_TMAX_CONST 10022 //e. 21 - maximum of the output value of the Tau regulator //r. 21 - ìàêñèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà Tau + #define L_VIB_START 5120 //e. 22 - pulse width of the dither drive (before noiseness)//r. 22 - äëèòåëüíîñòü èìïóëüñà âèáðîïðèâîäà (äî îøóìëåíèÿ) + //e. _VB_tau - initial pulse width of the dither drive //r. _VB_tau íà÷àëüíàÿ äëèòåëüíîñòü èìïóëüñà âèáðîïðèâîäà + + #define VBN_TZD_CONST 500 //e. 23 - adjusted noise[??] period (user`s constant) //r. 23 - çàäàííûé ïåðèîä îøóìëåíèÿ (êîíñòàíòà ïîëüçîâàòåëÿ) + #define VBN_RAN_CONST 400 //e. 24 - range of the random component of noiseness //r. 24 - äèàïàçîí ñëó÷àéíîé ñîñòàâëÿþùåé îøóìëåíèÿ VBN_Tsl + #define VBN_K_CONST 7000 //e. 25 - adjusted noise constant (user`s constant) //r. 25 - çàäàííàÿ êîíñòàíòà îøóìëåíèÿ (êîíñòàíòà ïîëüçîâàòåëÿ) + + //e. =============== parameters of DS power regulator ========== //r. =============== ïàðàìåòðû êîíòóðà ðåãóëèðîâàíèÿ ìîùíîñòè ÄÓÏ ========== + #define RI_REF_CONST 25600 //e. 5 - value of the reference //r. 5 - çíà÷åíèå îïîðû + #define RI_SCL_CONST 0 //e. 6 - the gain factor (1.15) //r. 6 - êîýôôèöèåíò ïåðåäà÷è (1.15) + + + //e. =============== parameters of processing of accurate data ============= //r. =============== ïàðàìåòðû îáðàáîòêè òî÷íîñòíîé èíôîðìàöèè ============= + #define PI_FSC_CONST 128 //e. 26 - the S_ds scale parameter //r. 26 - ìàñøòàáíûé êîýôôèöèåíò Säóï + #define PI_FB0_CONST 0 //e. 27 - the B_ds zero shift of the DS //r. 27 - ñìåùåíèå íóëÿ ÄÓÏà Bäóï + #define PI_SCL_CONST 256 //e. 28 - the Scale scale coefficient of the gyro //r. 28 - ìàñøòàáíûé êîýôô. ãèðîñêîïà Scale + #define PI_BIA_CONST 0 //e. 29 - the Bias zero shift of the gyro //r. 29 - ñìåùåíèå íóëÿ ãèðîñêîïà Bias + + //e. =============== coefficients of the temperature correction ================= //r. =============== êîýôôèöèåíòû òåìïåðàòóðíîé êîððåêöèè ================= + #define PI_A0_CONST 0 // 30 + #define PI_A1_CONST 0 // 31 + #define PI_A2_CONST 0 // 32 + #define PI_A3_CONST 0 // 33 + #define PI_A4_CONST 0 // 34 + #define PI_A5_CONST 0 // 35 + #define PI_A6_CONST 0 // 36 + #define PI_B1_CONST 0 // 37 + #define PI_B2_CONST 0 // 38 + #define PI_B3_CONST 0 // 39 + #define PI_B4_CONST 0 // 40 + #define PI_B5_CONST 0 // 41 + #define PI_B6_CONST 0 // 42 + + #define TMP_SCALE 0x4000 // 43 - 54 Tmp_bias[6]; Tmp_scal[6] + #define TMP_BIAS 0 + #define WP_RESET_CONST 7360 // 55 + #define WP_RESET2_CONST 29216 + #define WP_TRANS_STEP 32767 + //e. ================ initial gain factor of photodetector channels =========== //r. ================ íà÷àëüíûé ê-ò óñèëåíèÿ êàíàëîâ ôîòîïðèåìíèêà =========== + #define G_PHOTO_STRA 60 // 56 + #define G_PHOTO_STRB 60 // 57 + + //e. =============== switch of the source of loading GLD variables block === //r. =============== ïåðåêëþ÷àòåëü èñòî÷íèêà çàãðóçêè áëîêà ïåðåìåííûõ ÃËÄ === + #define HEADER_WORD_CONST 0x55aa //e. 58 - magic number flash validity //r. 58 - çàãîëîâîê-êëþ÷ ê èíäèêàòîðó èñòî÷íèêà çàãðóçêè + +#define DITHER_REG_PERIOD 40 //e. period of dither regulator (in periods of dither frequency) //r. ïåðèîä ðåãóëèðîâàíèÿ âèáðîïðèîäà (â ïåðèîäàõ âèáðîïðèâîäà) + +#define PLC_RESET_THRESHOLD (-3276) //e. correspond to the voltage +1.2 Volts //r. ñîîòâåòñòâóåò íàïðÿæåíèþ +1.2 âîëüòà + + //e. minimal allowable output frequency, at which data are considered authentic //r. ìèí.äîïóñòèìàÿ ÷àñòîòà ðàñùåïëåíèÿ, ïðè êîò. äàííûå ñ÷èòàþòñÿ äîñòîâåðíûìè +#define F_RAS_MIN 10000 //e. minimal output frequency at start //r. ìèíèìàëüíàÿ ÷àñòîòà ðàñùåïëåíèÿ ïðè ñòàðòå +#define F_OUT_MIN (5000>>4) // 5000 Ãö / 16 +#define F_OUT_NORM (70000>>4) // 90000 Ãö / 16 +#define F_OUT_MAX (300000>>4) // 300000 Ãö / 16 + +#define Set_LightUp LPC_GPIO0->FIOSET = (1<<4) //set light up signal +#define Reset_LightUp LPC_GPIO0->FIOCLR = (1<<4) //reset light up signal + + //e. constants for the piecewise-linear thermocompensation //r. êîíñòàíòû äëÿ êóñî÷íî-ëèíåéíîé òåðìîêîìïåíñàöèè +#define TERMO_FUNC_SIZE 14 //e. amount of the points of the table function of thermocompensation //r. êîëè÷åñòâî òî÷åê òàáëè÷íîé ôóíêöèè òåðìîêîìïåíñàöèè +#define MAX_ORDER 9 //e. maximal value of order for the thermocompensation coefficients //r. ìàêñèìàëüíàÿ âåëè÷èíà ïîðÿäêà äëÿ êîýôôèöèåíòîâ òåðìîêîìïåíñàöèè +#define TSENS_NUMB 4 //e. number of the temperature sensor used for the thermocompensation //r. íîìåð òåðìîäàò÷èêà, èñïîëüçóåìîãî äëÿ êîìïåíñàöèè + +#define VALID_START_4SEC 3 //e. time after start, when temperature came authentic //r. âðåìÿ ïîñëå ñòàðòà, êîãäà òåìïåðàòóðà ñòàëà äîñòîâåðíîé + +#define N_START_MAX 1 // 4 //e. count of attempts of device starting //r. ÷èñëî ïîïûòîê çàïóñêà ïðèáîðà +#define LIGHT_UP_PULSE_WDTH 5000 //1000 //e. width of light-up pulse = 100 msec +#define LIGHT_UP_PAUSE 1000 //e. pause after light-up = 100 msec +#define LIGHT_UP_POLLING 10000 //e. time of waiting laser generation = 1 sec + + // Status word errors bits +#define OUT_FREQ_ERROR 0x8000 +#define DITH_FREQ_ERROR 0x4000 +#define HFO_VOLT_ERROR 0x2000 +#define THERMO_RANGE_ERROR 0x1000 +#define THERMO_DIFF_ERROR 0x0800 + +#define TS_MIN -2500 // minimal temperature for our thermal sensors +#define TS_MAX +13000 // maximal temperature for our thermal sensors +#define TS_DIFF_MAX 1300 // maximal difference between 2 thermal sensors + +#define HFO_NEG_MIN 8738 // -4.5 V +#define HFO_NEG_MAX 25122 // -10.5 V +#define HFO_POZ_MIN -32221 // +10.5 V +#define HFO_POZ_MAX -15837 // +4.5 V + +//e. ================ bits of the main register (_RgConA) of GLD control ============== + //r. ================ áèòû îñíîâíîãî ðåãèñòðà óïðàâëåíèÿ GLD (_RgConA) =============== + //e. ================ (bits of the status register) ============================ + //r. ================ (îíè æå - áèòû ðåãèñòðà ñîñòîÿíèÿ) ============================ +#define LASER_ON 0x0001 //e. switch on/off laser-up //r. âêë./âûêë. ãåíåðàöèþ ëàçåðà +#define HF_REG_ON 0x0002 //e. switch on/off the HFO regulator //r. âêë./âûêë. êîíòóð ÃÂ× +#define RI_REG_ON 0x0004 //e. switch on/off the DS power regulator //r. âêë./âûêë. êîíòóð ìîùíîñòè ÄÓÏ +#define WP_REG_ON 0x0008 //e. a mask of switch on/off of the CPLC regulator //r. ìàñêà âêë./âûêë. êîíòóðà ÑÐÏ +#define WP_SIN_ON 0x0010 //e. switch on/off search signal of the CPLC //r. âêë./âûêë. ïîèñêîâûé ñèãíàë ÑÐÏ +#define VB_TAU_ON 0x0020 //e. switch on/off amplitude regulator of the dither drive //r. âêë./âûêë. êîíòóð àìïëèòóäû âèáðîðèâîäà +#define VB_FREQ_ON 0x0040 //e. switch on/off frequency regulator of the dither drive //r. âêë./âûêë. êîíòóð ÷àñòîòû âèáðîïðèâîäà +#define GLD_ON 0x0080 //e. switch on/off all GLD //r. âêë./âûêë. âåñü ÃËÄ + + // Status word errors bits +#define OUT_FREQ_ERROR 0x8000 +#define DITH_FREQ_ERROR 0x4000 +#define HFO_VOLT_ERROR 0x2000 +#define THERMO_RANGE_ERROR 0x1000 +#define THERMO_DIFF_ERROR 0x0800 + +#define loop_is_closed(loop_bit) ((RgConA & (loop_bit)) == loop_bit) +#define close_loop(loop_bit) RgConA |= loop_bit +#define open_loop(loop_bit) RgConA &= ~(loop_bit) + //e. switch off all regulators //r. âûêëþ÷èòü âñå êîíòóðà ðåãóëèðîâàíèÿ +#define open_all_loops() RgConA = 0 +#define close_all_loops() RgConA = 0xFFFF + +extern unsigned SRgR; //e. system register of the ADSP card //r.ñèñòåìíîãî ðåãèñòðà ðåæèìà ïëàòû ADSP + +extern unsigned RgConA; //e. main register of device control //r. îñíîâíîé ðåãèñòð óïðàâëåíèÿ óñòðîéñòâà +extern unsigned RgConB; //e. additional register of device control //r. äîïîëíèòåëüíûé ðåãèñòð óïðàâëåíèÿ +//extern unsigned Copy_e5_RgR; //e. copy of the mode register of the E5 card //r. êîïèÿ ðåãèñòðà ðåæèìà ïëàòû E5 +//extern unsigned Copy_e5_RgRA; //e. copy of the additional mode register of the E5 card //r. êîïèÿ äîïîëíèòåëüíîãî ðåãèñòðà ðåæèìà E5 + +void contrl_GLD(void); +#endif +