Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of LG by
Revision 1:f2adcae3d304, committed 2016-01-30
- Comitter:
- igor_v
- Date:
- Sat Jan 30 13:53:19 2016 +0000
- Parent:
- 0:8ad47e2b6f00
- Child:
- 2:2d0b80ed9216
- Commit message:
- 123
Changed in this revision
--- a/CntrlGLD.c Sat Jan 30 13:00:39 2016 +0000 +++ b/CntrlGLD.c Sat Jan 30 13:53:19 2016 +0000 @@ -1,6 +1,5 @@ - +#include "Global.h" -#include "Global.h" #define COMMAND_DEBUG uint32_t SRgR; //r. ��������� ������� ������ ����� ADSP @@ -66,10 +65,10 @@ #endif } // GLD_Stop + void GLD_Status(void) //r.---------- ���������� �������� ���������� ��� -------------------------- { static uint32_t Device_Mode_Old = DM_INT_10KHZ_LATCH/*DM_EXT_LATCH_DELTA_SF_PULSE*/; - if ( loop_is_closed(GLD_ON) == 0 ) { open_all_loops(); @@ -86,6 +85,7 @@ } } // GLD_Status + void Sts_Pause(void) //r.------- ��������� ��������� ����� -------------------------------------- { if (sts_work) //r. ��������� � �������� ����?
--- a/CntrlGLD.h Sat Jan 30 13:00:39 2016 +0000 +++ b/CntrlGLD.h Sat Jan 30 13:53:19 2016 +0000 @@ -1,91 +1,91 @@ +#ifndef CntrlGLD_H +#define CntrlGLD_H -#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. íîìåð òåðìîäàò÷èêà, èñïîëüçóåìîãî äëÿ êîìïåíñàöèè +//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. ðåæèìû ðàáîòû òåðìîêîìïåíñàöèè +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_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. âàðèàíòû êîíòðîëüíûõ òî÷åê äëÿ îñöèëëîãðàôà +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. âûõîä ôàçîâîãî äåòåêòîðà êîíòóðà ÑÐÏ + 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 êÃö +//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 +#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) + //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 - ñîáñòâåííûé àäðåñ óñòðîéñòâà + 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 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 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 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 - ìàêñèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà ïåðèîäà + //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_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 - çàäàííàÿ êîíñòàíòà îøóìëåíèÿ + 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. =============== 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. =============== êîýôôèöèåíòû òåìïåðàòóðíîé êîððåêöèè ================= + //e. =============== coefficients of the temperature correction ================= //r. =============== ������������ ������������� ��������� ================= int PI_a0; //_ // 30 int PI_a1; //_ // 31 int PI_a2; //_ // 32 @@ -100,40 +100,40 @@ int PI_b5; //_ // 41 int PI_b6; //_ // 42 - //e. =============== parameters of normalization of the temperature sensors ============= //r. =============== ïàðàìåòðû íîðìèðîâêè äàò÷èêîâ òåìïåðàòóðû ============= + //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 - èñõîäíîå ïîëîæåíèå ðåãóëÿòîðà ÑÐÏ (ïîñëå ñáðîñà) + 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. ================ 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 - ñåðèéíûé íîìåð ïðèáîðà + //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. äîáàâëåíèå äëÿ êóñî÷íî-ëèíåéíîé òåðìîêîððåêöèè + 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. ïàðàìåòðû, çàäàþùèå ïàðàìåòðû òåðìîêîìïåíñàöèè â äèíàìèêå (ïðè íàãðåâå è îõëàæäåíèè) + 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 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 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 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; @@ -149,79 +149,79 @@ -//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-ïàìÿòè +//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; //r. ìèíèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà ïåðèîäà äëÿ òåìïåðàòóðû Device_blk.TemperNormal -extern int VB_Nmax0; //r. ìàêñèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà ïåðèîäà äëÿ òåìïåðàòóðû Device_blk.TemperNormal +extern int VB_Nmin0; //r. ������� ��������� �������� ���������� ������� ��� ����������� Device_blk.TemperNormal +extern int VB_Nmax0; //r. �������� ��������� �������� ���������� ������� ��� ����������� Device_blk.TemperNormal extern unsigned BIT_number; extern unsigned Is_BIT; -extern unsigned start_Rq; //r. çàïðîñ íà çàïóñê ïðèáîðà -extern unsigned stop_Rq; //r. çàïðîñ íà îñòàíîâ ïðèáîðà -extern unsigned pulse_Rq; //r. çàïðîñ íà ïîäæèã ëàçåðà +extern unsigned start_Rq; //r. ������ �� ������ ������� +extern unsigned stop_Rq; //r. ������ �� ������� ������� +extern unsigned pulse_Rq; //r. ������ �� ������ ������ - //r. *** Ïðèáîðíûå ïàðàìåòðû ïî óìîë÷àíèþ *** -#define DEVICE_SN 1 //r. ñåðèéíûé íîìåð ïðèáîðà = 01 -#define My_Addres_const 0 //r. - ñîáñòâåííûé àäðåñ óñòðîéñòâà + //r. *** ��������� ��������� �� ��������� *** +#define DEVICE_SN 1 //r. �������� ����� ������� = 01 +#define My_Addres_const 0 //r. - ����������� ����� ���������� - //r. ====== ïàðàìåòðû êîíòóðà Â× ãåíåðàòîðà íàêà÷êè =============== + //r. ====== ��������� ������� �� ���������� ������� =============== - #define HF_REF_CONST 15080 //r. 1 - çíà÷åíèå îïîðû - #define HF_SCL_CONST 1 //r. 2 - êîýôôèöèåíò ïåðåäà÷è (1.15) - #define HF_MIN_CONST -32668 //r. 3 - ìèíèìóì âûõîäíîãî çíà÷åíèÿ íà ÖÀÏå ðåãóëÿòîðà (ñîîòâåòñòâóåò ìàêñèì. íàïðÿæåíèþ íà ÃÂ×) - #define HF_MAX_CONST -17379 //r. 4 - ìàêñèìóì âûõîäíîãî çíà÷åíèÿ íà ÖÀÏå ðåãóëÿòîðà (ñîîòâåòñòâóåò ìèíèì. íàïðÿæåíèþ íà ÃÂ×) - #define HFO_SHIFT 16 //r. ÷èñëî ðàçðÿäîâ äðîáíîé ÷àñòè â 32-õáèòîâîé ïåðåìåííîé hf_reg32 + #define HF_REF_CONST 15080 //r. 1 - �������� ����� + #define HF_SCL_CONST 1 //r. 2 - ����������� �������� (1.15) + #define HF_MIN_CONST -32668 //r. 3 - ������� ��������� �������� �� ���� ���������� (������������� ������. ���������� �� ���) + #define HF_MAX_CONST -17379 //r. 4 - �������� ��������� �������� �� ���� ���������� (������������� �����. ���������� �� ���) + #define HFO_SHIFT 16 //r. ����� �������� ������� ����� � 32-�������� ���������� hf_reg32 - //r. ====== ïàðàìåòðû êîíòóðà ñòàáèëèçàöèè ðàáî÷åãî ïåðèìåòðà (ÑÐÏ) ===== + //r. ====== ��������� ������� ������������ �������� ��������� (���) ===== - #define WP_REF_CONST 5 //r. 7 - çíà÷åíèå îïîðû - #define WP_SCL_CONST 5 //r. 8 - êîýôôèöèåíò ïåðåäà÷è (1.15) - #define WP_MDY_CONST 30 //r. 9 - çíà÷åíèå çàäåðæêè ñáðîñà - #define WP_RUP_CONST 31936 //r. 10 - íèæíåå çíà÷åíèå ðåãóëèðîâêè ÖÀÏ (ñîîòâåòñòâóåò ìèíèì. íàïðÿæåíèþ íà íàãðåâàòåëå) - #define WP_RDW_CONST 11801 //r. 11 - âåðõíåå çíà÷åíèå ðåãóëèðîâêè ÖÀÏ (ñîîòâåòñòâóåò ìàêñèì. íàïðÿæåíèþ íà íàãðåâàòåëå) + #define WP_REF_CONST 5 //r. 7 - �������� ����� + #define WP_SCL_CONST 5 //r. 8 - ����������� �������� (1.15) + #define WP_MDY_CONST 30 //r. 9 - �������� �������� ������ + #define WP_RUP_CONST 31936 //r. 10 - ������ �������� ����������� ��� (������������� �����. ���������� �� �����������) + #define WP_RDW_CONST 11801 //r. 11 - ������� �������� ����������� ��� (������������� ������. ���������� �� �����������) -//r. =============== ïàðàìåòðû êîíòóðà âèáðîïðèâîäà ÃËÄ ==================== +//r. =============== ��������� ������� ������������ ��� ==================== - #define VB_PHS_CONST 4 //r. 12 - ïàðàìåòð Phase_çàä. ÑÐ× âèáðîïðèâîäà - #define VB_SCL_CONST 1024 //r. 13 - êîýôôèöèåíò ïåðåäà÷è (1.15) ÑÐ× âèáðîïðèâîäà - #define T_VIB_START 16600 //r. 14 - êîýôô.äåëåíèÿ N âèáðîïðèâîäà (ïåðèîä êîëåáàíèé) ÂÏ - //r. _VB_N íà÷àëüíûé ïåðèîä êîëåáàíèé âèáðîïðèâîäà (406Hz-18916, 17067 - 450Hz) - #define T_VIB_DELTA 1000 //r. äèàïàçîí èçìåíåíèÿ ïåðèîäà êîëåáàíèé âèáðîïðèâîäà (~ +/- 10 Hz) + #define VB_PHS_CONST 4 //r. 12 - �������� Phase_���. ��� ������������ + #define VB_SCL_CONST 1024 //r. 13 - ����������� �������� (1.15) ��� ������������ + #define T_VIB_START 16600 //r. 14 - �����.������� N ������������ (������ ���������) �� + //r. _VB_N ��������� ������ ��������� ������������ (406Hz-18916, 17067 - 450Hz) + #define T_VIB_DELTA 1000 //r. �������� ��������� ������� ��������� ������������ (~ +/- 10 Hz) - #define VB_NMIN_CONST 12080 //r. 15 - ìèíèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà ïåðèîäà - #define VB_NMAX_CONST 64000 //r. 16 - ìàêñèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà ïåðèîäà - #define VB_FDF_HI_CONST 3 //r. 17 - çàäàííàÿ ÷àñòîòà ðàñùåïëåíèÿ (H) - #define VB_FDF_LO_CONST 0 //r. 18 - (L) (äâîéíàÿ òî÷íîñòü) - #define VB_FSC_CONST -2000 //r. 19 - êîýôôèöèåíò ïåðåäà÷è ðåãóëÿòîðà ÷àñòîòû ðàñùåïëåíèÿ - #define VB_TMIN_CONST 100 //r. 20 - ìèíèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà Tau - #define VB_TMAX_CONST 10022 //r. 21 - ìàêñèìóì âûõîäíîãî çíà÷åíèÿ ðåãóëÿòîðà Tau - #define L_VIB_START 5120 //r. 22 - äëèòåëüíîñòü èìïóëüñà âèáðîïðèâîäà (äî îøóìëåíèÿ) - //r. _VB_tau íà÷àëüíàÿ äëèòåëüíîñòü èìïóëüñà âèáðîïðèâîäà + #define VB_NMIN_CONST 12080 //r. 15 - ������� ��������� �������� ���������� ������� + #define VB_NMAX_CONST 64000 //r. 16 - �������� ��������� �������� ���������� ������� + #define VB_FDF_HI_CONST 3 //r. 17 - �������� ������� ����������� (H) + #define VB_FDF_LO_CONST 0 //r. 18 - (L) (������� ��������) + #define VB_FSC_CONST -2000 //r. 19 - ����������� �������� ���������� ������� ����������� + #define VB_TMIN_CONST 100 //r. 20 - ������� ��������� �������� ���������� Tau + #define VB_TMAX_CONST 10022 //r. 21 - �������� ��������� �������� ���������� Tau + #define L_VIB_START 5120 //r. 22 - ������������ �������� ������������ (�� ���������) + //r. _VB_tau ��������� ������������ �������� ������������ - #define VBN_TZD_CONST 500 //r. 23 - çàäàííûé ïåðèîä îøóìëåíèÿ (êîíñòàíòà ïîëüçîâàòåëÿ) - #define VBN_RAN_CONST 400 //r. 24 - äèàïàçîí ñëó÷àéíîé ñîñòàâëÿþùåé îøóìëåíèÿ VBN_Tsl - #define VBN_K_CONST 7000 //r. 25 - çàäàííàÿ êîíñòàíòà îøóìëåíèÿ (êîíñòàíòà ïîëüçîâàòåëÿ) + #define VBN_TZD_CONST 500 //r. 23 - �������� ������ ��������� (��������� ������������) + #define VBN_RAN_CONST 400 //r. 24 - �������� ��������� ������������ ��������� VBN_Tsl + #define VBN_K_CONST 7000 //r. 25 - �������� ��������� ��������� (��������� ������������) - //r. =============== ïàðàìåòðû êîíòóðà ðåãóëèðîâàíèÿ ìîùíîñòè ÄÓÏ ========== - #define RI_REF_CONST 25600 //r. 5 - çíà÷åíèå îïîðû - #define RI_SCL_CONST 0 //r. 6 - êîýôôèöèåíò ïåðåäà÷è (1.15) + //r. =============== ��������� ������� ������������� �������� ��� ========== + #define RI_REF_CONST 25600 //r. 5 - �������� ����� + #define RI_SCL_CONST 0 //r. 6 - ����������� �������� (1.15) - //r. =============== ïàðàìåòðû îáðàáîòêè òî÷íîñòíîé èíôîðìàöèè ============= - #define PI_FSC_CONST 128 //r. 26 - ìàñøòàáíûé êîýôôèöèåíò Säóï - #define PI_FB0_CONST 0 //r. 27 - ñìåùåíèå íóëÿ ÄÓÏà Bäóï - #define PI_SCL_CONST 256 //r. 28 - ìàñøòàáíûé êîýôô. ãèðîñêîïà Scale - #define PI_BIA_CONST 0 //r. 29 - ñìåùåíèå íóëÿ ãèðîñêîïà Bias + //r. =============== ��������� ��������� ���������� ���������� ============= + #define PI_FSC_CONST 128 //r. 26 - ���������� ����������� S��� + #define PI_FB0_CONST 0 //r. 27 - �������� ���� ���� B��� + #define PI_SCL_CONST 256 //r. 28 - ���������� �����. ��������� Scale + #define PI_BIA_CONST 0 //r. 29 - �������� ���� ��������� Bias - //r. =============== êîýôôèöèåíòû òåìïåðàòóðíîé êîððåêöèè ================= + //r. =============== ������������ ������������� ��������� ================= #define PI_A0_CONST 0 // 30 #define PI_A1_CONST 0 // 31 #define PI_A2_CONST 0 // 32 @@ -241,34 +241,34 @@ #define WP_RESET_CONST 7360 // 55 #define WP_RESET2_CONST 29216 #define WP_TRANS_STEP 32767 -//r. ================ íà÷àëüíûé ê-ò óñèëåíèÿ êàíàëîâ ôîòîïðèåìíèêà =========== +//r. ================ ��������� �-� �������� ������� ������������� =========== #define G_PHOTO_STRA 60 // 56 #define G_PHOTO_STRB 60 // 57 - //r. =============== ïåðåêëþ÷àòåëü èñòî÷íèêà çàãðóçêè áëîêà ïåðåìåííûõ ÃËÄ === - #define HEADER_WORD_CONST 0x55aa //r. 58 - çàãîëîâîê-êëþ÷ ê èíäèêàòîðó èñòî÷íèêà çàãðóçêè + //r. =============== ������������� ��������� �������� ����� ���������� ��� === + #define HEADER_WORD_CONST 0x55aa //r. 58 - ���������-���� � ���������� ��������� �������� -#define DITHER_REG_PERIOD 40 //r. ïåðèîä ðåãóëèðîâàíèÿ âèáðîïðèîäà (â ïåðèîäàõ âèáðîïðèâîäà) +#define DITHER_REG_PERIOD 40 //r. ������ ������������� ����������� (� �������� ������������) -#define PLC_RESET_THRESHOLD (-3276) //r. ñîîòâåòñòâóåò íàïðÿæåíèþ +1.2 âîëüòà +#define PLC_RESET_THRESHOLD (-3276) //r. ������������� ���������� +1.2 ������ -//r. ìèí.äîïóñòèìàÿ ÷àñòîòà ðàñùåïëåíèÿ, ïðè êîò. äàííûå ñ÷èòàþòñÿ äîñòîâåðíûìè -#define F_RAS_MIN 10000 //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 +//r. ���.���������� ������� �����������, ��� ���. ������ ��������� ������������ +#define F_RAS_MIN 10000 //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 - //r. êîíñòàíòû äëÿ êóñî÷íî-ëèíåéíîé òåðìîêîìïåíñàöèè -#define TERMO_FUNC_SIZE 14 //r. êîëè÷åñòâî òî÷åê òàáëè÷íîé ôóíêöèè òåðìîêîìïåíñàöèè -#define MAX_ORDER 9 //r. ìàêñèìàëüíàÿ âåëè÷èíà ïîðÿäêà äëÿ êîýôôèöèåíòîâ òåðìîêîìïåíñàöèè -#define TSENS_NUMB 4 //r. íîìåð òåðìîäàò÷èêà, èñïîëüçóåìîãî äëÿ êîìïåíñàöèè + //r. ��������� ��� �������-�������� ���������������� +#define TERMO_FUNC_SIZE 14 //r. ���������� ����� ��������� ������� ���������������� +#define MAX_ORDER 9 //r. ������������ �������� ������� ��� ������������� ���������������� +#define TSENS_NUMB 4 //r. ����� ������������, ������������� ��� ����������� -#define VALID_START_4SEC 3 //r. âðåìÿ ïîñëå ñòàðòà, êîãäà òåìïåðàòóðà ñòàëà äîñòîâåðíîé +#define VALID_START_4SEC 3 //r. ����� ����� ������, ����� ����������� ����� ����������� -#define N_START_MAX 1 // 4 //r. ÷èñëî ïîïûòîê çàïóñêà ïðèáîðà +#define N_START_MAX 1 // 4 //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 @@ -290,17 +290,17 @@ #define HFO_POZ_MAX -15837 // +4.5 V //e. ================ bits of the main register (_RgConA) of GLD control ============== - //r. ================ áèòû îñíîâíîãî ðåãèñòðà óïðàâëåíèÿ GLD (_RgConA) =============== + //r. ================ ���� ��������� �������� ���������� GLD (_RgConA) =============== //e. ================ (bits of the status register) ============================ - //r. ================ (îíè æå - áèòû ðåãèñòðà ñîñòîÿíèÿ) ============================ -#define LASER_ON 0x0001 //r. âêë./âûêë. ãåíåðàöèþ ëàçåðà -#define HF_REG_ON 0x0002 //r. âêë./âûêë. êîíòóð ÃÂ× -#define RI_REG_ON 0x0004 //r. âêë./âûêë. êîíòóð ìîùíîñòè ÄÓÏ -#define WP_REG_ON 0x0008 //r. ìàñêà âêë./âûêë. êîíòóðà ÑÐÏ -#define WP_SIN_ON 0x0010 //r. âêë./âûêë. ïîèñêîâûé ñèãíàë ÑÐÏ -#define VB_TAU_ON 0x0020 //r. âêë./âûêë. êîíòóð àìïëèòóäû âèáðîðèâîäà -#define VB_FREQ_ON 0x0040 //r. âêë./âûêë. êîíòóð ÷àñòîòû âèáðîïðèâîäà -#define GLD_ON 0x0080 //r. âêë./âûêë. âåñü ÃËÄ + //r. ================ (��� �� - ���� �������� ���������) ============================ +#define LASER_ON 0x0001 //r. ���./����. ��������� ������ +#define HF_REG_ON 0x0002 //r. ���./����. ������ ��� +#define RI_REG_ON 0x0004 //r. ���./����. ������ �������� ��� +#define WP_REG_ON 0x0008 //r. ����� ���./����. ������� ��� +#define WP_SIN_ON 0x0010 //r. ���./����. ��������� ������ ��� +#define VB_TAU_ON 0x0020 //r. ���./����. ������ ��������� ����������� +#define VB_FREQ_ON 0x0040 //r. ���./����. ������ ������� ������������ +#define GLD_ON 0x0080 //r. ���./����. ���� ��� // Status word errors bits #define OUT_FREQ_ERROR 0x8000 @@ -312,18 +312,19 @@ #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) - //r. âûêëþ÷èòü âñå êîíòóðà ðåãóëèðîâàíèÿ + //r. ��������� ��� ������� ������������� #define open_all_loops() RgConA = 0 #define close_all_loops() RgConA = 0xFFFF -extern unsigned SRgR; //r.ñèñòåìíîãî ðåãèñòðà ðåæèìà ïëàòû ADSP +extern unsigned SRgR; //r.���������� �������� ������ ����� ADSP -extern unsigned RgConA; //r. îñíîâíîé ðåãèñòð óïðàâëåíèÿ óñòðîéñòâà -extern unsigned RgConB; //r. äîïîëíèòåëüíûé ðåãèñòð óïðàâëåíèÿ -//extern unsigned Copy_e5_RgR; //r. êîïèÿ ðåãèñòðà ðåæèìà ïëàòû E5 -//extern unsigned Copy_e5_RgRA; //r. êîïèÿ äîïîëíèòåëüíîãî ðåãèñòðà ðåæèìà E5 +extern unsigned RgConA; //r. �������� ������� ���������� ���������� +extern unsigned RgConB; //r. �������������� ������� ���������� +//extern unsigned Copy_e5_RgR; //r. ����� �������� ������ ����� E5 +//extern unsigned Copy_e5_RgRA; //r. ����� ��������������� �������� ������ E5 void contrl_GLD(void); + #endif
--- a/Dither_Reg.c Sat Jan 30 13:00:39 2016 +0000 +++ b/Dither_Reg.c Sat Jan 30 13:53:19 2016 +0000 @@ -1,11 +1,5 @@ -#include "LPC17xx.h" -#include "mathDSP.h" -#include "InputOutput.h" -#include "CyclesSync.h" -#include "CntrlGLD.h" -#include "stdlib.h" -#include "SIP.h" -#include "console.h" +#include "Global.h" + #define SHIFT_7680_12500 15 //e. 14 digits for 7680 to 12500 clock converting and 1 division digit
--- a/Global.h Sat Jan 30 13:00:39 2016 +0000 +++ b/Global.h Sat Jan 30 13:53:19 2016 +0000 @@ -55,6 +55,65 @@ #include "el_lin.h" +#include "InputOutput.h" +#include "CyclesSync.h" +#include "LPC17xx.h" +//-------------------temp------- +#include "el_lin.h" + +#include "QEI.h" +#include "vibro.h" +#include "MTimer.h" + + +#include "mathDSP.h" +#include "CyclesSync.h" +#include "ThermoCalc.h" +#include "CntrlGLD.h" +#include "InputOutput.h" + #include "ThermoCalc.h" + #include "CyclesSync.h" + #include "CntrlGLD.h" + #include "InputOutput.h" + + +#include "console.h" + +#include "CyclesSync.h" + + + + + +#include "InputOutput.h" +#include "CyclesSync.h" +#include "CntrlGLD.h" +#include "stdlib.h" +#include "SIP.h" +#include "console.h" + + + +#include "mathDSP.h" +#include "InputOutput.h" +#include "CntrlGLD.h" + + +#include "CyclesSync.h" +#include "CntrlGLD.h" +#include "el_lin.h" + + +#include "commandset.h" +#include "el_lin.h" +#include "CyclesSync.h" +#include "CntrlGLD.h" +#include "InputOutput.h" +#include "Parameters.h" + + + + @@ -77,5 +136,7 @@ extern unsigned char BuffTemp[]; +//#ifndef Global_H +//#define Global_H #endif // Global_H
--- a/HFO_Reg.c Sat Jan 30 13:00:39 2016 +0000 +++ b/HFO_Reg.c Sat Jan 30 13:53:19 2016 +0000 @@ -1,6 +1,4 @@ -#include "mathDSP.h" -#include "InputOutput.h" -#include "CntrlGLD.h" +#include "Global.h" #define HFO_NEG_MIN 8738 // -4.5 V #define HFO_NEG_MAX 25122 // -10.5 V @@ -19,11 +17,11 @@ void clc_HFO() // --- HFO regulator --- { - static int hf_reg = 0; //r. çíà÷åíèå èíòåãðàòîðà â êîíòóðå ÃÂ× + static int hf_reg = 0; //r. �������� ����������� � ������� ��� ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //r. ôèëüòðàöèÿ âûõîäà àìïë. äåòåêòîðà ïåðåä ïåðåäà÷åé â êîíòóð ÃÂ× + //r. ���������� ������ ����. ��������� ����� ��������� � ������ ��� /*int HFO_MovAverFilt (int Input) { static __int64 smooth_HF = 0; @@ -43,21 +41,21 @@ }*/ -// HFO_SHIFT - ÷èñëî ðàçðÿäîâ äðîáíîé ÷àñòè â 32-õáèòîâîé ïåðåìåííîé hf_reg32 +// HFO_SHIFT - ����� �������� ������� ����� � 32-�������� ���������� hf_reg32 Input.StrIn.HF_out = HFO_MovAverFilt(Input.StrIn.HF_out<<HFO_SHIFT); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Output.Str.HF_dif = L_sub(Device_blk.Str.HF_ref, Input.StrIn.HF_out); // HF_dif = HF_out - Device_blk.Str.HF_ref; - if ( loop_is_closed(HF_REG_ON) ) //e. the regulator loop is closed //r. êîíòóð çàìêíóò - {// êîýôôèöèåíò ïåðåäà÷è + if ( loop_is_closed(HF_REG_ON) ) //e. the regulator loop is closed //r. ������ ������� + {// ����������� �������� hf_reg = L_mac( hf_reg, Output.Str.HF_dif, Device_blk.Str.HF_scl ); // hf_reg32 += HFO_error * Device_blk.Str.HF_scl; - Saturation(hf_reg, Device_blk.Str.HF_max << HFO_SHIFT, Device_blk.Str.HF_min << HFO_SHIFT); //e. checking range //r. ïðîâåðêà äèàïàçîíà if (Uin > UpSat) Uin = UpSat; if (Uin < DownSat) Uin = DownSat; + Saturation(hf_reg, Device_blk.Str.HF_max << HFO_SHIFT, Device_blk.Str.HF_min << HFO_SHIFT); //e. checking range //r. �������� ��������� if (Uin > UpSat) Uin = UpSat; if (Uin < DownSat) Uin = DownSat; Output.Str.HF_reg = (hf_reg >> HFO_SHIFT); // Output.Str.HF_reg - HFO output voltage } else { - hf_reg = Output.Str.HF_reg << HFO_SHIFT; //r. èíòåãðàòîðó ïðèñâàèâàåì ïðåäûäóùåå çíà÷åíèå HF_reg + hf_reg = Output.Str.HF_reg << HFO_SHIFT; //r. ����������� ����������� ���������� �������� HF_reg } // cyclic built-in test
--- a/InputOutput.c Sat Jan 30 13:00:39 2016 +0000 +++ b/InputOutput.c Sat Jan 30 13:53:19 2016 +0000 @@ -1,10 +1,8 @@ -#include "InputOutput.h" -#include "CyclesSync.h" -#include "LPC17xx.h" -//-------------------temp------- -#include "el_lin.h" -INPUT Input; -OUTPUT Output; + +#include "Global.h" + +//INPUT Input; +//OUTPUT Output; volatile uint32_t I2CMasterState = I2C_IDLE; volatile uint32_t I2CMasterBuffer[I2C_WRITELENGTH];
--- a/InputOutput.h Sat Jan 30 13:00:39 2016 +0000 +++ b/InputOutput.h Sat Jan 30 13:53:19 2016 +0000 @@ -1,8 +1,10 @@ +#ifndef InputOutput_H +#define InputOutput_H -#include "Global.h" #include "stdint.h" + //******************************I2C************************************************* #define I2C0 @@ -89,6 +91,9 @@ } OUTPUT; + + + typedef union { int ArrayIn[3]; struct { @@ -127,5 +132,5 @@ void G_Photo_Init( void ); void G_Photo_Exchange(void); -//endof file +#endif // InputOutput_H
--- a/PLC_reg.c Sat Jan 30 13:00:39 2016 +0000 +++ b/PLC_reg.c Sat Jan 30 13:53:19 2016 +0000 @@ -13,33 +13,30 @@ ** **-------------------------------------------------------------------------------------------------------- *********************************************************************************************************/ -#include "mathDSP.h" -#include "CyclesSync.h" -#include "ThermoCalc.h" -#include "CntrlGLD.h" -#include "InputOutput.h" -#include <math.h> +#include "Global.h" + -#define CONFIG_HFO_REG //r. èçìåíÿåì êîýôôèöèåíò ïåðåäà÷è êîíòóðà ÃÂ× îò íîìèíàëüíîãî íà âðåìÿ îáíóëåíèÿ + +#define CONFIG_HFO_REG //r. �������� ����������� �������� ������� ��� �� ������������ �� ����� ��������� #define WP_TRANSITION_ENA // - //e.--- constants for the CPLC regulator ------------------------------------------------------- //r.--- êîíñòàíòû äëÿ êîíòóðà ÑÐÏ ------------------------------------------------------- + //e.--- constants for the CPLC regulator ------------------------------------------------------- //r.--- ��������� ��� ������� ��� ------------------------------------------------------- #define PLC_SHIFT (6) -#define PLC_PHASE_DET_SHIFT (18) //e. 18 - for analog output //r. 18 - äëÿ àíàëîãîâîãî +#define PLC_PHASE_DET_SHIFT (18) //e. 18 - for analog output //r. 18 - ��� ����������� -#define PLC_RESET_THRESHOLD (-3276) //e. correspond to the voltage +1.2 Volts //r. ñîîòâåòñòâóåò íàïðÿæåíèþ +1.2 âîëüòà +#define PLC_RESET_THRESHOLD (-3276) //e. correspond to the voltage +1.2 Volts //r. ������������� ���������� +1.2 ������ #define WP_REG32MAX_SATURATION (32767 << PLC_SHIFT) #define WP_REG32MIN_NEW_SATURATION (PLC_RESET_THRESHOLD << PLC_SHIFT) -#define WP_TMP_THRESHOLD (7) //e. temperature threshold, defining heats up or cool down the device //r. òåìïåðàòóðíûé ïîðîã, îïðåäåëÿþùèé íàãðåâàåòñÿ èëè îõëàæäàåòñÿ ïðèáîð +#define WP_TMP_THRESHOLD (7) //e. temperature threshold, defining heats up or cool down the device //r. ������������� �����, ������������ ����������� ��� ����������� ������ #define debugPLC int WP_reg32; - int WP_Phase_Det; //e. output of the phase detector of the CPLC (in a digital kind)//r. âûõîä ôàçîâîãî äåòåêòîðà ÑÐÏ (â öèôðîâîì âèäå) - int WP_reset_heating; //e. voltage of reset at heating //r. íàïðÿæåíèå ñáðîñà ïðè íàãðåâàíèè - int WP_reset_cooling; //e. voltage of reset at cooling //r. íàïðÿæåíèå ñáðîñà ïðè îõëàæäåíèè + int WP_Phase_Det; //e. output of the phase detector of the CPLC (in a digital kind)//r. ����� �������� ��������� ��� (� �������� ����) + int WP_reset_heating; //e. voltage of reset at heating //r. ���������� ������ ��� ���������� + int WP_reset_cooling; //e. voltage of reset at cooling //r. ���������� ������ ��� ���������� int MaxDelayPLC; int sin_func[100]; @@ -59,38 +56,38 @@ void init_PLC(void) { int i; - //( 1,2 âîëüòà) - if (Device_blk.Str.WP_reset < PLC_RESET_THRESHOLD) //e. íàïðÿæåíèå ïîñëå ñáðîñà íà íàãðåâàòåëå íå äîëæíî ïðåâûøàòü 1,2 âîëüòà. - //(èñõîäíîå çíà÷åíèå ðåãóëÿòîðà ÑÐÏ (ïîñëå ñáðîñà)) < (-3276). + //( 1,2 ������) + if (Device_blk.Str.WP_reset < PLC_RESET_THRESHOLD) //e. ���������� ����� ������ �� ����������� �� ������ ��������� 1,2 ������. + //(�������� �������� ���������� ��� (����� ������)) < (-3276). { Device_blk.Str.WP_reset = PLC_RESET_THRESHOLD + 1;//(-3275) } -//íàïðÿæåíèå íà ÑÐÏ = (ìèí. çíà÷åíèå íà íàãðåâàòåëå + ìàõ. çíà÷åíèå íà íàãðåâàòåëå)/2 +//���������� �� ��� = (���. �������� �� ����������� + ���. �������� �� �����������)/2 Output.Str.WP_reg = (Device_blk.Str.WP_rup + Device_blk.Str.WP_rdw) >> 1; //e. WP_reg start voltage is (WP_rup - WP_rdw)/2 - // íàïðÿæåíèå íà ÑÐÏ << 6 + // ���������� �� ��� << 6 WP_reg32 = Output.Str.WP_reg<<PLC_SHIFT; - if ((Device_blk.Str.PI_b3>100)||(Device_blk.Str.PI_b3<10)) //e. Åñëè òðåáóåìàÿ ÷àñòîòà ìîäóëÿòîðà ÑÐÏ áîëüøå 1kHz èëè ìåíüøå 100Hz - Device_blk.Str.PI_b3 = 40; //e. Óñòàíîâèòü ÷àñòîòó â 250Hz (÷àñòîòà äðåáåçäåíèÿ) + if ((Device_blk.Str.PI_b3>100)||(Device_blk.Str.PI_b3<10)) //e. ���� ��������� ������� ���������� ��� ������ 1kHz ��� ������ 100Hz + Device_blk.Str.PI_b3 = 40; //e. ���������� ������� � 250Hz (������� �����������) - for (i = 0; i<Device_blk.Str.PI_b3; i++) //e. Ñêàíèðîâàíèå ÑÐÏ ñèãíàëà + for (i = 0; i<Device_blk.Str.PI_b3; i++) //e. ������������ ��� ������� { - float temp = sin((float)i*2.0*PI/(float)Device_blk.Str.PI_b3); /// âû÷èñëåíèå çíà÷åíèé ñèíóñà - /// äëÿ ÷àñòîòû ìîäóëÿòîðà ñðï (PI_b3), - sin_func[i] = (int)(temp*32767); /// è êàëèáðîâêà ýòèõ çíà÷åíèé äëÿ ÀÖÏ. + float temp = sin((float)i*2.0*PI/(float)Device_blk.Str.PI_b3); /// ���������� �������� ������ + /// ��� ������� ���������� ��� (PI_b3), + sin_func[i] = (int)(temp*32767); /// � ���������� ���� �������� ��� ���. if (sin_func[i] < 0) sin_func[i] += 65536; } //e. calculation of filter coefficients for PLC // 250 Hz 10 KHz - init_BandPass( 1.0/(float)Device_blk.Str.PI_b3, 10.0/(float)(DEVICE_SAMPLE_RATE_HZ), PLC); //ïîëîñîôîé ôèëüòð äëÿ âûäåëåíèÿ ÷àñòîòû êîëåáàíèÿ ìîäóëÿòîðà - //è îïðåäåëåíèå êîýôèöèåíòîâ(aPLC[0-2] è bPLC[0-2]) - //(äðåáåçäåíèå ñðï äëÿ îïðåäåëåíèÿ ãðåòü èëè îõëîæäàòü îñíîâíîé ýëåìåíò óïðàâëåíèÿ.) + init_BandPass( 1.0/(float)Device_blk.Str.PI_b3, 10.0/(float)(DEVICE_SAMPLE_RATE_HZ), PLC); //��������� ������ ��� ��������� ������� ��������� ���������� + //� ����������� ������������(aPLC[0-2] � bPLC[0-2]) + //(����������� ��� ��� ����������� ����� ��� ��������� �������� ������� ����������.) Device_blk.Str.WP_scl <<= 1; //e. during fist 10 seconds after start we state Device_blk.Str.WP_scl = 2*Device_blk.Str.WP_scl - // ïåðâûå 10 ñåêóíä ðàáîòàòü ñ êîýôèöèåíòîì ïåðåäà÷è * 2 + // ������ 10 ������ �������� � ������������ �������� * 2 MaxDelayPLC = Device_blk.Str.PI_b3>>1; //e. max expected delay for phase detector output } // init_PLC @@ -113,10 +110,10 @@ return (flag); } - //e. check whether delay exceeds the greatest possible value //r. ïðîâåðêà íå ïðåâîñõîäèò ëè çàäåðæêà ìàêñèìàëüíî âîçìîæíóþ + //e. check whether delay exceeds the greatest possible value //r. �������� �� ����������� �� �������� ����������� ��������� if (Device_blk.Str.WP_ref > MaxDelayPLC) { Device_blk.Str.WP_ref = MaxDelayPLC; } - if (flag) //e. outgoing poz_sin_flag flag, which delayed by the WP_ref //r. ôîðìèðîâàíèå çàäåðæàííîãî íà âåëè÷èíó WP_ref ôëàãà poz_sin_flag + if (flag) //e. outgoing poz_sin_flag flag, which delayed by the WP_ref //r. ������������ ������������ �� �������� WP_ref ����� poz_sin_flag { neg_counter = 0; poz_counter++; @@ -151,10 +148,10 @@ static int plc_reset32; static enum - { //r. ñîñòîÿíèå ëèíåéíîãî ïåðåõîäà ïðè îáíóëåíèè ÑÐÏ - FINISHED, //r. ëèíåéíûé ïåðåõîä çàâåðøåí - TRANS_HEATING, //r. ïåðåõîä âûïîëíÿåòñÿ ïðè íàãðåâàíèè - TRANS_COOLING //r. ïåðåõîä âûïîëíÿåòñÿ ïðè îõëàæäåíèè + { //r. ��������� ��������� �������� ��� ��������� ��� + FINISHED, //r. �������� ������� �������� + TRANS_HEATING, //r. ������� ����������� ��� ���������� + TRANS_COOLING //r. ������� ����������� ��� ���������� } plc_transiton = FINISHED; // int i; @@ -168,7 +165,7 @@ poz_sin_flag = 1; } - //r. ïîëîñîâîé ôèëüòð äëÿ êîíòóðà ÑÐÏ + //r. ��������� ������ ��� ������� ��� WP_Phase_Det = PLC_PhaseDetFilt(/*Output.Str.WP_sin*/Input.StrIn.WP_sel); @@ -191,34 +188,34 @@ } // from this WP_Phase_Det - demodulated signal like LIDEM_DIG - if (!is_zeroing) //r. Íå ïîðà âûïîëíÿòü îáíóëåíèå - { //r. íåò îáíóëåíèÿ - if ((WP_reg32 > (Device_blk.Str.WP_rup << PLC_SHIFT)) && IsHeating) //r. ïðîèñõîäèò íàãðåâàíèå + if (!is_zeroing) //r. �� ���� ��������� ��������� + { //r. ��� ��������� + if ((WP_reg32 > (Device_blk.Str.WP_rup << PLC_SHIFT)) && IsHeating) //r. ���������� ���������� { is_zeroing = 1; - //r. íàïðÿæåíèå ñáðîñà ïðè íàãðåâàíèè + //r. ���������� ������ ��� ���������� WP_reset_heating = CPL_reset_calc(Device_blk.Str.WP_reset, Device_blk.Str.K_WP_rst_heating, Temp_Aver, Device_blk.Str.TemperNormal); plc_transiton = TRANS_HEATING; plc_reset32 = WP_reset_heating << PLC_SHIFT;; - Device_blk.Str.HF_scl = Device_blk.Str.HF_scl_2; //r. èçìåíÿåì êîýôôèöèåíò ïåðåäà÷è êîíòóðà ÃÂ× îò íîìèíàëüíîãî íà âðåìÿ îáíóëåíèÿ + Device_blk.Str.HF_scl = Device_blk.Str.HF_scl_2; //r. �������� ����������� �������� ������� ��� �� ������������ �� ����� ��������� } - else if ((WP_reg32 < (Device_blk.Str.WP_rdw << PLC_SHIFT)) && !IsHeating) //r. îõëàæäåíèå + else if ((WP_reg32 < (Device_blk.Str.WP_rdw << PLC_SHIFT)) && !IsHeating) //r. ���������� { is_zeroing = 1; - //r. íàïðÿæåíèå ñáðîñà ïðè îõëàæäåíèè + //r. ���������� ������ ��� ���������� WP_reset_cooling = CPL_reset_calc(Device_blk.Str.WP_reset2, Device_blk.Str.K_WP_rst_cooling, Temp_Aver, Device_blk.Str.TemperNormal); plc_transiton = TRANS_COOLING; plc_reset32 = WP_reset_cooling << PLC_SHIFT; - Device_blk.Str.HF_scl = Device_blk.Str.HF_scl_2; //r. èçìåíÿåì êîýôôèöèåíò ïåðåäà÷è êîíòóðà ÃÂ× îò íîìèíàëüíîãî íà âðåìÿ îáíóëåíèÿ + Device_blk.Str.HF_scl = Device_blk.Str.HF_scl_2; //r. �������� ����������� �������� ������� ��� �� ������������ �� ����� ��������� } - else //r. ïîðîãè íå ïðåâûøåíû, îáû÷íàÿ ðàáîòà êîíòóðà + else //r. ������ �� ���������, ������� ������ ������� WP_reg32 = L_mac(WP_reg32, phase_Digital, Device_blk.Str.WP_scl ); // WP_reg32 += phase_Digital * Device_blk.Str.WP_scl; } - else //r. ôëàã óñòàíîâëåí (1) - ðåæèì îáíóëåíèÿ + else //r. ���� ���������� (1) - ����� ��������� { if (plc_transiton != FINISHED) @@ -251,32 +248,32 @@ { zero_delay++; } - else //e. resetting was completed //r. îáíóëåíèå çàêîí÷èëîñü + else //e. resetting was completed //r. ��������� ����������� { is_zeroing = 0; - //e. save the temperature for further comparison //r. çàïîìèíàåì òåìïåðàòóðó äëÿ äàëüíåéøåãî ñðàâíåíèÿ + //e. save the temperature for further comparison //r. ���������� ����������� ��� ����������� ��������� // TempOfReset = Temp_Aver; //r.x. Temp5_Aver; //r. Tmp_Out[TSENS_NUMB]; // T4; - //r.x Zero_Numb_dbg++; // òàê ìîæíî ïîäñ÷èòûâàòü ÷èñëî îáíóëåíèé + //r.x Zero_Numb_dbg++; // ��� ����� ������������ ����� ��������� - // DithFreqRangeCalc(); //e. calculation of range of the division factor for the dither drive frequency, depending on current temperature //r. ðàñ÷åò ãðàíèö êîýôôèöèåíòà äåëåíèÿ äëÿ ÷àñòîòû âèáðîïðèâîäà, çàâèñÿùèõ îò òåêóùåé òåìïåðàòóðû + // DithFreqRangeCalc(); //e. calculation of range of the division factor for the dither drive frequency, depending on current temperature //r. ������ ������ ������������ ������� ��� ������� ������������, ��������� �� ������� ����������� } } - Saturation(WP_reg32, WP_REG32MAX_SATURATION, WP_REG32MIN_NEW_SATURATION); //e. the minimum corresponds to a small negative number, appropriate to PLC_RESET_THRESHOLD //r. ìèíèìóì ñîîòâåòñòâóåò íåáîëüøîìó îòðèöàòåëüíîìó ÷èñëó, ñîîòâ-ìó PLC_RESET_THRESHOLD + Saturation(WP_reg32, WP_REG32MAX_SATURATION, WP_REG32MIN_NEW_SATURATION); //e. the minimum corresponds to a small negative number, appropriate to PLC_RESET_THRESHOLD //r. ������� ������������� ���������� �������������� �����, �����-�� PLC_RESET_THRESHOLD - if ( loop_is_closed(WP_REG_ON) ) //e. the regulator loop is closed //r. êîíòóð çàìêíóò + if ( loop_is_closed(WP_REG_ON) ) //e. the regulator loop is closed //r. ������ ������� { - Output.Str.WP_reg = (int)(WP_reg32 >> PLC_SHIFT); //e. we use as controlling - voltages of the integrator //r. èñïîëüçóåì êàê óïðàâëÿþùåå - íàïðÿæåíèÿ èíòåãðàòîðà + Output.Str.WP_reg = (int)(WP_reg32 >> PLC_SHIFT); //e. we use as controlling - voltages of the integrator //r. ���������� ��� ����������� - ���������� ����������� } - else //e. the regulator loop is open //r. êîíòóð ðàçîìêíóò + else //e. the regulator loop is open //r. ������ ��������� { - WP_reg32 = Output.Str.WP_reg << PLC_SHIFT; //e. set the previous value of the WP_reg //r. ïðèñâàèâàåì ïðåäûäóùåå çíà÷åíèå WP_reg + WP_reg32 = Output.Str.WP_reg << PLC_SHIFT; //e. set the previous value of the WP_reg //r. ����������� ���������� �������� WP_reg } - //e. integartion of output of the PD of the CPLC regulator for the technological output on the Rate command //r. èíòåãðèðîâàíèå âûõîäà ÔÄ êîíòóðà ÑÐÏ äëÿ òåõíîëîãè÷åñêîãî âûâîäà ïî êîìàíäå Rate + //e. integartion of output of the PD of the CPLC regulator for the technological output on the Rate command //r. �������������� ������ �� ������� ��� ��� ���������������� ������ �� ������� Rate Output.Str.WP_pll = WP_PhaseDetectorRate( WP_Phase_Det, time_1_Sec); @@ -291,7 +288,7 @@ ** Returned value: code to DAC ** ******************************************************************************/ -int Signal_2_Oscill() //e. the signal for the control by scope on DAC output (was DS) //r. ñèãíàë äëÿ êîíòðîëÿ îñöèëëîãðàôîì íà âûõîäå ÖÀÏ (áûâøèé ÄÓÏ) +int Signal_2_Oscill() //e. the signal for the control by scope on DAC output (was DS) //r. ������ ��� �������� ������������� �� ������ ��� (������ ���) { // Scope_Mode var not used now, reserved for future applications return (-WP_Phase_Det << 2);
--- a/QEI.c Sat Jan 30 13:00:39 2016 +0000 +++ b/QEI.c Sat Jan 30 13:53:19 2016 +0000 @@ -1,13 +1,10 @@ -#include "lpc17xx.h" -#include "QEI.h" -#include "vibro.h" -#include "MTimer.h" +#include "Global.h" int Pulse_midl = 0; int PulseHalf = 0; int CuruAngle = 0; int Dif_QEI; -int FFF=0;//äëÿ çàïëàòêè +int FFF=0;//��� �������� int Pulse_8Point = 0; int Pulse_16Point = 0; @@ -31,21 +28,21 @@ Dif_QEI=0; - Cur_QEI = LPC_QEI->POS & 0xFFFF; // ñ÷èòûâàíèå òåêóùåãî çíà÷åíèÿ ýíêîäåðà. - Dif_QEI = (Cur_QEI - Last_QEI); // ïîëó÷åíèå ïðèðàùåíèÿ.() - Last_QEI = Cur_QEI; // çàïèñü òåêóùåãî çíà÷åíèÿ ýíêîäåðà â ðåãèñòð ïðåäûäóùåãî çíà÷åíèÿ. + Cur_QEI = LPC_QEI->POS & 0xFFFF; // ���������� �������� �������� ��������. + Dif_QEI = (Cur_QEI - Last_QEI); // ��������� ����������.() + Last_QEI = Cur_QEI; // ������ �������� �������� �������� � ������� ����������� ��������. - if (Dif_QEI < -0xfff) Dif_QEI += 0x10000; // îáðàáîòêà ïðîõîäà çíà÷åíèÿ ÷åðåç íîëü - if (Dif_QEI > 0xfff) Dif_QEI -= 0x10000; // îáðàáîòêà ïðîõîäà çíà÷åíèÿ ÷åðåç íîëü + if (Dif_QEI < -0xfff) Dif_QEI += 0x10000; // ��������� ������� �������� ����� ���� + if (Dif_QEI > 0xfff) Dif_QEI -= 0x10000; // ��������� ������� �������� ����� ���� - Buff_1Point[CountV255] = (unsigned int) (Dif_QEI + 0xffff);// íàêîïëåíèå â áóôåð åäåíè÷íûõ çíà÷åíèé ïðèðàùåíèÿ ïî êàæäîìó òàêòó. + Buff_1Point[CountV255] = (unsigned int) (Dif_QEI + 0xffff);// ���������� � ����� ��������� �������� ���������� �� ������� �����. //////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// - if (LPC_QEI->STAT) //e. "+" direction //r. ñòàëè âðàùàòüñÿ â "+" ñòîðîíó + if (LPC_QEI->STAT) //e. "+" direction //r. ����� ��������� � "+" ������� { Main.Cnt_Mns = Dif_QEI; } @@ -53,28 +50,28 @@ { Main.Cnt_Pls = -Dif_QEI; } - ////////// ???? Çàïëàòêà - ////////// ???? Ïðîáëåìà íà÷àëüíîãî çàïîëíåíèÿ áóôåðîâ + ////////// ???? �������� + ////////// ???? �������� ���������� ���������� ������� ////////////////////////////////////////////////////////////////////////////////////////////// - if(FFF==1) // åñëè ïðîøëî 32 òàêòà âèáðî ïîäâåñà íà÷àòü çàïîëíÿòü îñòàëüíûå áóâåðû. + if(FFF==1) // ���� ������ 32 ����� ����� ������� ������ ��������� ��������� ������. { Pulse_8Point += Buff_1Point[CountV255]; - Pulse_8Point -= Buff_1Point[(CountV255-8) & 0xff]; // çàïîëíåíèå áóôåðà íàêîïëåíûõ ïðèðàùåíèé çà 8 òàêòîâ + Pulse_8Point -= Buff_1Point[(CountV255-8) & 0xff]; // ���������� ������ ���������� ���������� �� 8 ������ Buff_8Point[CountV255] = (unsigned int) (Pulse_8Point + 0xffff); Pulse_16Point += Buff_1Point[CountV255]; - Pulse_16Point -= Buff_1Point[(CountV255-16) & 0xff]; // çàïîëíåíèå áóôåðà íàêîïëåíûõ ïðèðàùåíèé çà 16 òàêòîâ + Pulse_16Point -= Buff_1Point[(CountV255-16) & 0xff]; // ���������� ������ ���������� ���������� �� 16 ������ Buff_16Point[CountV255] = (unsigned int) (Pulse_16Point + 0xffff); Pulse_32Point += Buff_1Point[CountV255]; - Pulse_32Point -= Buff_1Point[(CountV255-32) & 0xff]; // çàïîëíåíèå áóôåðà íàêîïëåíûõ ïðèðàùåíèé çà 32 òàêòîâ + Pulse_32Point -= Buff_1Point[(CountV255-32) & 0xff]; // ���������� ������ ���������� ���������� �� 32 ������ Main.Cnt_Dif = (Pulse_32Point+ 0xffff); Buff_32Point[CountV255] = (unsigned int) (Pulse_32Point + 0xffff); Pulse_16PointD += Buff_1Point[CountV255]; - Pulse_16PointD -= Buff_1Point[(CountV255-16) & 0xff]; // çàïîëíåíèå áóôåðà íàêîïëåíûõ ïðèðàùåíèé çà 16 òàêòîâ Äâîéíûç + Pulse_16PointD -= Buff_1Point[(CountV255-16) & 0xff]; // ���������� ������ ���������� ���������� �� 16 ������ ������� Pulse_16PointD += Buff_1Point[(CountV255-32) & 0xff]; // - Pulse_16PointD -= Buff_1Point[(CountV255-48) & 0xff]; // ç + Pulse_16PointD -= Buff_1Point[(CountV255-48) & 0xff]; // � Buff_16PointD[CountV255] = (unsigned int) (Pulse_16PointD + 0xffff); @@ -104,7 +101,7 @@ } else if(CountV255 == 255) { - FFF=1;//âðåìåííàÿ çàïëàòêà äëÿ ïàóçû ïåðåä çàïîëíåíèåì îñòàëüíûõ áóôåðîâ + FFF=1;//��������� �������� ��� ����� ����� ����������� ��������� ������� for (yy = 0; yy < 256; yy++ ) { Buff_1Point [yy] = 0xffff;
--- a/SIP.c Sat Jan 30 13:00:39 2016 +0000 +++ b/SIP.c Sat Jan 30 13:53:19 2016 +0000 @@ -1,10 +1,6 @@ -#include "mathDSP.h" -#include "SIP.h" -#include "CyclesSync.h" -#include "CntrlGLD.h" -#include "InputOutput.h" -#include "ThermoCalc.h" -#include "el_lin.h" + +#include "Global.h" + uint32_t Old_Cnt_Vib = 0; @@ -12,8 +8,8 @@ int32_t RefMeand_Cnt_Dif; int32_t PSdif_sum_Vib_32 = 0; __int64 PSdif_sum_Vib_64 = 0; - int32_t dif_Curr_32_Ext; //r. ðàçíîñòü (÷èñëî) äëÿ ðåæèìà âíåøíåé çàùåëêè - int32_t dif_Curr_32_previous; //e. Previous (in comparison with Dif_Curr_32) number //r. ïðåäûäóùåå (ïî ñðàâíåíèþ ñ Dif_Curr_32) ÷èñëî + int32_t dif_Curr_32_Ext; //r. �������� (�����) ��� ������ ������� ������� + int32_t dif_Curr_32_previous; //e. Previous (in comparison with Dif_Curr_32) number //r. ���������� (�� ��������� � Dif_Curr_32) ����� int32_t temp22=0; //+++++++++++++++++++++++++++++++INPUT DATA++++++++++++++++++++++++++++++++++++++++++++++++ uint32_t Curr_Cnt_Vib; @@ -23,11 +19,11 @@ int32_t Dif_Curr_Vib; //e. current difference output for dithering control in LightUp mode and Dither regulator int32_t Dif_Curr_32; //e. current difference without dithering for dithering control -#if (defined GLOBALRATE)//íå âõîäèò +#if (defined GLOBALRATE)//�� ������ //variables for rate mode int32_t cntPls_sum_32; - ñññ int32_t last_Cnt_Plus; + ��� int32_t last_Cnt_Plus; int32_t dif_sum_32; int32_t Cnt_Pls; int32_t Cnt_Mns; @@ -44,12 +40,12 @@ int hi_part; hi_part = *x32 >> truncate_bits; - *x32 -= hi_part << truncate_bits; //r. îñòàâëÿåì ìëàäøèå 16 áèò + *x32 -= hi_part << truncate_bits; //r. ��������� ������� 16 ��� } /****************************************************************************** ** Function name: interpolation ** -** Descriptions: êîëè÷åñòâî èòåðïîëÿöèé äî ïîÿâëåíèÿ âíåøíåé çàùåëêè +** Descriptions: ���������� ����������� �� ��������� ������� ������� ** ** Returned value: Number in moment of external latch appearing ** parameters: y_curr - current number, y_prev - number at one cycle before time @@ -92,12 +88,12 @@ static int32_t preLast_Cnt_Plus; #endif - Dif_Curr_Vib = Curr_Cnt_Vib - Old_Cnt_Vib; //Âû÷èñëåíèå ïðèðàùåíèÿ òåêóùåãî ñ÷åò÷èêà èìïóëüñîâ. + Dif_Curr_Vib = Curr_Cnt_Vib - Old_Cnt_Vib; //���������� ���������� �������� �������� ���������. - Old_Cnt_Vib = Curr_Cnt_Vib; //ñîõðàíåíèå òåêóùåãî ñ÷åò÷èêà èìïóëüñîâ äëÿ ñëåäóþùåãî öèêëà èçìåðåíèé + Old_Cnt_Vib = Curr_Cnt_Vib; //���������� �������� �������� ��������� ��� ���������� ����� ��������� - Cnt_Overload(Dif_Curr_Vib, INT32MAX_DIV2, INT32MIN_DIV2); //ïðîâåðêà íà ïåðåïîëíåíèå (Dif_Curr_Vib). + Cnt_Overload(Dif_Curr_Vib, INT32MAX_DIV2, INT32MIN_DIV2); //�������� �� ������������ (Dif_Curr_Vib). // Uin UpSat DwnSat //#define Cnt_Overload(Uin, UpSat, DwnSat) @@ -112,36 +108,36 @@ } */ - Dif_Curr_32 = VibroReduce(Dif_Curr_Vib << SHIFT_TO_FRACT); // Òî÷íîñòü ôèëüòðàöèè 1/(2^18) + Dif_Curr_32 = VibroReduce(Dif_Curr_Vib << SHIFT_TO_FRACT); // �������� ���������� 1/(2^18) - switch (RgConB) //r. äîïîëíèòåëüíûé ðåãèñòð óïðàâëåíèÿ + switch (RgConB) //r. �������������� ������� ���������� { - case RATE_VIBRO_1: //r. ðàçíîñòü âèáðîñ÷åò÷èêîâ ïîñëå ôèëüòðà ñêîëüçÿùíãî ñðåäíåãî + case RATE_VIBRO_1: //r. �������� �������������� ����� ������� ����������� �������� if (Latch_Rdy) //e. latch has arrived { - //dif_Curr_32_Ext ðàçíîñòü (÷èñëî) äëÿ ðåæèìà âíåøíåé çàùåëêè - dif_Curr_32_Ext = interpolation(Dif_Curr_32, LatchPhase ); //èíòåðïîëÿöèÿ + //dif_Curr_32_Ext �������� (�����) ��� ������ ������� ������� + dif_Curr_32_Ext = interpolation(Dif_Curr_32, LatchPhase ); //������������ Output.Str.Tmp_Out[2] = (int)((Curr_Cnt_Vib>>16)& 0xffff); Output.Str.Tmp_Out[3] = (int)(Curr_Cnt_Vib & 0xffff); - //r. äîáàâëÿåì ê íàêîïëåííîé ñóììå èíòåðïîëèðîâàííûé îòñ÷åò âíåøíåé çàùåëêè + //r. ��������� � ����������� ����� ����������������� ������ ������� ������� PSdif_sum_Vib_32 += dif_Curr_32_Ext; PSdif_sum_Vib_64 += dif_Curr_32_Ext; //e. receive last data //count--; - //r. ïîäãîòîâèòü ÷èñëî äëÿ âûäà÷è - Output.Str.BINS_dif = PSdif_sum_Vib_32 - TermoCompens_Sum; //r. èç íàêîïëåííîãî ÷èñëà âû÷èòàåì íàêîïëåííóþ òåðìîêîìïåíñàöèîííóþ ñîñòàâëÿþùóþ + //r. ����������� ����� ��� ������ + Output.Str.BINS_dif = PSdif_sum_Vib_32 - TermoCompens_Sum; //r. �� ������������ ����� �������� ����������� �������������������� ������������ Output.Str.PS_dif = Output.Str.BINS_dif >> 16; LatchPhase = INT32_MAX; //INT32_MAX=2147483647 //in Latch_Event it's indicator of latch appearing Output.Str.SF_dif = PSdif_sum_Vib_64; - TermoCompens_Sum = 0; //r. îáíóëÿåì íàêîïëåííóþ òåðìîêîìïåíñàöèþ äëÿ íà÷àëà íîâîãî öèêëà íàêîïëåíèÿ + TermoCompens_Sum = 0; //r. �������� ����������� ���������������� ��� ������ ������ ����� ���������� if ((Device_Mode == DM_EXT_LATCH_DELTA_BINS_PULSE)||((Device_Mode == DM_EXT_LATCH_DELTA_SF_PULSE) && Ext_Latch_ResetEnable)) { - PSdif_sum_Vib_32 = 0; //r. èíèöèàëèçèðîâàòü íîâûé öèêë èçìåðåíèÿ ïî çàùåëêå + PSdif_sum_Vib_32 = 0; //r. ���������������� ����� ���� ��������� �� ������� PSdif_sum_Vib_64 = 0; } else @@ -150,17 +146,17 @@ dif_Curr_32_Ext = Dif_Curr_32 - temp22;//dif_Curr_32_Ext; PSdif_sum_Vib_32 += dif_Curr_32_Ext; // preserve rest of counters difference for next measure cycle: PSdif_sum_Vib_32 += Dif_Curr_32 - dif_Curr_32_Ext; - PSdif_sum_Vib_64 += dif_Curr_32_Ext; //ñîõðàíèòü îñòàëüíûå ñ÷åò÷èêè ðàçíèöû äëÿ ñëåäóþùåãî òàêòà öèêëà + PSdif_sum_Vib_64 += dif_Curr_32_Ext; //��������� ��������� �������� ������� ��� ���������� ����� ����� } - else //r. çàùåëêè íà íàñòîÿùèé ìîìåíò íå áûëî + else //r. ������� �� ��������� ������ �� ���� { - //r. ïðîäîëæàåì íàêàïëèâàòü ñóììó èç âíóòðåííèõ îòñ÷åòîâ + //r. ���������� ����������� ����� �� ���������� �������� PSdif_sum_Vib_32 += Dif_Curr_32; // PSdif_sum_Vib_32 += Dif_Curr_32 ; PSdif_sum_Vib_64 += Dif_Curr_32; //e. sum for scale factor measurement mode } - dif_Curr_32_previous = Dif_Curr_32; //r. çàïîìèíàåì ïðåäûäóùåå ÷èñëî + dif_Curr_32_previous = Dif_Curr_32; //r. ���������� ���������� ����� break; case RATE_REPER_OR_REFMEANDR: @@ -172,14 +168,14 @@ // LPC_GPIO2->FIOCLR = 0x10; Cnt_Overload(RefMeand_Cnt_Dif, INT32MAX_DIV2, INT32MIN_DIV2); - if (LPC_QEI->STAT) //e. "+" direction //r. ñòàëè âðàùàòüñÿ â "+" ñòîðîíó + if (LPC_QEI->STAT) //e. "+" direction //r. ����� ��������� � "+" ������� { //sumCnt_Mns += -RefMeand_Cnt_Dif; //e. accumulation during 1 sec Cnt_Mns = RefMeand_Cnt_Dif; } else { - //r. ñòàëè âðàùàòüñÿ â "-" ñòîðîíó + //r. ����� ��������� � "-" ������� //sumCnt_Pls += RefMeand_Cnt_Dif; //e. accumulation during 1 sec Cnt_Pls = -RefMeand_Cnt_Dif; } @@ -207,9 +203,9 @@ Output.Str.Cnt_Dif = dif_sum_32; Output.Str.Cnt_Dif += cntPls_sum_32 >> 1; - dif_sum_32 = 0; //r. è ñáðîñèòü ðåãèñòðû íàêîïëåíèÿ - ResetBitsOfWord(&cntPls_sum_32, 1); //r. îñòàâëÿåì ìëàäøèé ðàçðÿä, ÷òîáû íå òåðÿëàñü òî÷íîñòü ïðè ñóììèðîâàíèè - preLast_Cnt_Plus = last_Cnt_Plus; //r. òåêóùèé ïîñëåäíèé îòñ÷åò ñòàë ïðåäûäóùèì + dif_sum_32 = 0; //r. � �������� �������� ���������� + ResetBitsOfWord(&cntPls_sum_32, 1); //r. ��������� ������� ������, ����� �� �������� �������� ��� ������������ + preLast_Cnt_Plus = last_Cnt_Plus; //r. ������� ��������� ������ ���� ���������� Output.Str.Cnt_Mns = Cnt_Mns;//sumCnt_Mns; //e. rewrite accumulated data to output Output.Str.Cnt_Pls = Cnt_Pls;//sumCnt_Pls; @@ -219,9 +215,9 @@ } break; // RATE_REPER_OR_REFMEANDR } - //e. WP_scope1, WP_scope2 - variables for control in the Rate3 mode //r. WP_scope1, WP_scope2 - ïåðåìåííûå äëÿ êîíòðîëÿ â ðåæèìå rate3 + //e. WP_scope1, WP_scope2 - variables for control in the Rate3 mode //r. WP_scope1, WP_scope2 - ���������� ��� �������� � ������ rate3 Output.Str.WP_scope1 = Dif_Curr_Vib; - Output.Str.WP_scope2 = (Dif_Curr_32 >> (SHIFT_TO_FRACT-2)); //r. 2 äðîáíûõ ðàçðÿäà îñòàâëÿåì äëÿ áîëüøåé íàãëÿäíîñòè ïðè àíàëèçå ñèãíàëà rate3 + Output.Str.WP_scope2 = (Dif_Curr_32 >> (SHIFT_TO_FRACT-2)); //r. 2 ������� ������� ��������� ��� ������� ����������� ��� ������� ������� rate3 } // clc_Pulses @@ -237,19 +233,19 @@ ******************************************************************************/ void SOI_Init(void) { - LPC_SC->PCONP |= (1<<18);//0x00040000; âêëþ÷åíèå êâàäðàòóðíîãî ýíêîäåðà. - LPC_SC->PCLKSEL1 |= 0x00000001; // âûáîð ÷àñòîòû äëÿ êâ.ý. CLK=100MHz + LPC_SC->PCONP |= (1<<18);//0x00040000; ��������� ������������� ��������. + LPC_SC->PCLKSEL1 |= 0x00000001; // ����� ������� ��� ��.�. CLK=100MHz LPC_PINCON->PINSEL3 &= ~0x4100; - LPC_PINCON->PINSEL3 |= 0x4100; //P1.20, p1.23 óñòàíîâèòü êàê âõîäû êâ.ý - LPC_PINCON->PINMODE3 |= 0x3C300; //P1.20, p1.23, p1.24 ??are pulled-down??(ïðèòÿíóòü ê ïèòàíèþ)???? + LPC_PINCON->PINSEL3 |= 0x4100; //P1.20, p1.23 ���������� ��� ����� ��.� + LPC_PINCON->PINMODE3 |= 0x3C300; //P1.20, p1.23, p1.24 ??are pulled-down??(��������� � �������)???? - LPC_QEI->MAXPOS = MAX_QEI_CNT; //LPC_QEI->"ðåãèñòîð ìàêñèìàëüíîãî ïîëîæåíèÿ" = 2147483646 - LPC_QEI->FILTER = 2; // ôèëüòð( ?? ) - LPC_QEI->CON = 0xF; //ñáðîñèòü â íîëü âñå ñ÷åò÷èêè êâ.ý. (ñêîðîñòü, íàïðàâëåíèå, ïîçèöèþ è òä) + LPC_QEI->MAXPOS = MAX_QEI_CNT; //LPC_QEI->"�������� ������������� ���������" = 2147483646 + LPC_QEI->FILTER = 2; // ������( ?? ) + LPC_QEI->CON = 0xF; //�������� � ���� ��� �������� ��.�. (��������, �����������, ������� � ��) LPC_QEI->CONF = (0<<2) |(0<<1); //Quadrature inputs, no inverting,only A pulses are counted - LPC_QEI->CLR = 0x1fff; //r. ñáðîñèòü âñå ïðåðûâàíèÿ - LPC_QEI->IEC = 0x1fff; //r. çàïðåòèòü ïðåðûâàíèå ïðè èçìåíåíèè íàïðàâëåíèÿ + LPC_QEI->CLR = 0x1fff; //r. �������� ��� ���������� + LPC_QEI->IEC = 0x1fff; //r. ��������� ���������� ��� ��������� ����������� NVIC_SetPriority(QEI_IRQn, 0); NVIC_EnableIRQ(QEI_IRQn);
--- a/SPI.h Sat Jan 30 13:00:39 2016 +0000 +++ b/SPI.h Sat Jan 30 13:53:19 2016 +0000 @@ -1,3 +1,10 @@ + + + +#ifndef SPI_H +#define SPI_H + + #define RX_SSP_notEMPT 0x00000004 extern unsigned int Temp_AMP; @@ -32,3 +39,5 @@ extern struct SPI Spi; extern void SPI_Exchange(); extern void Init_SPI_Exchange(); + +#endif // SPI_H
--- a/ThermoCalc.c Sat Jan 30 13:00:39 2016 +0000 +++ b/ThermoCalc.c Sat Jan 30 13:53:19 2016 +0000 @@ -1,8 +1,4 @@ - #include "ThermoCalc.h" - #include "CyclesSync.h" - #include "CntrlGLD.h" - #include "InputOutput.h" - #include "mathDSp.h" +#include "Global.h" #define debug #define TEMP_AVER_PERIOD 4 // e. number of seconds for average @@ -13,12 +9,12 @@ int dThermoCoolDeltaPer_dTermo[TERMO_FUNC_SIZE]; int dFuncPer_dTermo[TERMO_FUNC_SIZE]; int TermoCompDelta; - int Temp_Aver; //e. the mean temperature for 1 Sec for T4 sensor //r. ñðåäíÿÿ òåìïåðàòóðà çà 1 ñåêóíäó äëÿ äàò÷èêà T4 + int Temp_Aver; //e. the mean temperature for 1 Sec for T4 sensor //r. ������� ����������� �� 1 ������� ��� ������� T4 int TempEvolution = 0; - int StartTermoCompens = 0; //e. initial thermocompensation (in XXX seconds after start ) //r. íà÷àëüíàÿ òåðìîêîìïåíñàöèÿ (÷åðåç ÕÕÕ ñåêóíä ïîñëå ñòàðòà) + int StartTermoCompens = 0; //e. initial thermocompensation (in XXX seconds after start ) //r. ��������� ���������������� (����� ��� ������ ����� ������) -extern int WP_reset_heating; //e. voltage of reset at heating //r. íàïðÿæåíèå ñáðîñà ïðè íàãðåâàíèè -extern int WP_reset_cooling; //e. voltage of reset at cooling //r. íàïðÿæåíèå ñáðîñà ïðè îõëàæäåíèè +extern int WP_reset_heating; //e. voltage of reset at heating //r. ���������� ������ ��� ���������� +extern int WP_reset_cooling; //e. voltage of reset at cooling //r. ���������� ������ ��� ���������� __inline Max_Saturation(unsigned *lvl, unsigned limit) { @@ -26,32 +22,32 @@ } /*{ - switch (Device_blk.Str.TermoMode) //e. selecting thermocompensation mode //r. âûáîð ðåæèìà òåðìîêîìïåíñàöèè + switch (Device_blk.Str.TermoMode) //e. selecting thermocompensation mode //r. ����� ������ ���������������� { case TERMO_ON: case TERMO_ON_NUMB_OFF: - TermoCompens_Sum += StartTermoCompens + DynamicDeltaCalc(); //e. accumulation of the value of thermocompensation from request to request //r. íàêîïëåíèå âåëè÷èíû òåðìîêîìïåíñàöèè îò çàïðîñà äî çàïðîñà + TermoCompens_Sum += StartTermoCompens + DynamicDeltaCalc(); //e. accumulation of the value of thermocompensation from request to request //r. ���������� �������� ���������������� �� ������� �� ������� break; case TERMO_ON_STATIC_ONLY: case TERMO_ON_STATIC_ONLY_NUMB_OFF: #if !defined debug_SOI - TermoCompens_Sum += StartTermoCompens; //e. accumulation of the value of thermocompensation from request to request //r. íàêîïëåíèå âåëè÷èíû òåðìîêîìïåíñàöèè îò çàïðîñà äî çàïðîñà + TermoCompens_Sum += StartTermoCompens; //e. accumulation of the value of thermocompensation from request to request //r. ���������� �������� ���������������� �� ������� �� ������� #endif break; case TERMO_ON_DYNAMIC_ONLY: case TERMO_ON_DYNAMIC_ONLY_NUMB_OFF: #if !defined debug_SOI - TermoCompens_Sum += DynamicTermoCompens(); //e. accumulation of the value of thermocompensation from request to request //r. íàêîïëåíèå âåëè÷èíû òåðìîêîìïåíñàöèè îò çàïðîñà äî çàïðîñà + TermoCompens_Sum += DynamicTermoCompens(); //e. accumulation of the value of thermocompensation from request to request //r. ���������� �������� ���������������� �� ������� �� ������� #endif break; case TERMO_OFF: default: - TermoCompens_Sum = 0; //e. thermocompensation is disable, therefore its part is equal to zero //r. òåðìîêîìïåíñàöèÿ âûêëþ÷åíà, ïîýòîìó åå âêëàä ðàâåí íóëþ + TermoCompens_Sum = 0; //e. thermocompensation is disable, therefore its part is equal to zero //r. ���������������� ���������, ������� �� ����� ����� ���� } //of thermomode switch } */ @@ -64,16 +60,16 @@ ** Returned value: None ** ******************************************************************************/ -int StaticTermoCompens(int temperature) //r. ðàñ÷åò ñòàòè÷åñêîé ñîñòàâëÿþùåé òåðìîêîìïåíñàöèè çà îäèí ïåðèîä ïðèáîðà (100 ìêñ) +int StaticTermoCompens(int temperature) //r. ������ ����������� ������������ ���������������� �� ���� ������ ������� (100 ���) { - float TermoCompens_Curr; //r. âåëè÷èíà òåðìîêîìïåíñàöèè çà îäèí ïåðèîä ïðèáîðà (100 ìêñ) + float TermoCompens_Curr; //r. �������� ���������������� �� ���� ������ ������� (100 ���) int i, t; - //r. èñïîëüçóåì òîëüêî òåðìîäàò÷èê TSENS_NUMB - //r. äëÿ íîâûõ òåðìîäàò÷èêîâ: T4, äëÿ ñòàðûõ: T1 - //r. è èñïîëüçóåì êóñî÷íî-íåïðåðûâíóþ òåðìîêîìïåíñàöèþ + //r. ���������� ������ ����������� TSENS_NUMB + //r. ��� ����� �������������: T4, ��� ������: T1 + //r. � ���������� �������-����������� ���������������� //r. Tmp_Out[TSENS_NUMB] = 8960; //-2560; //5120; //8000; // -2600; //-5000; @@ -89,17 +85,17 @@ //r. Tmp_Out[5] = i; TermoCompens_Curr = Device_blk.Str.TermoFunc[i] - dFuncPer_dTermo[i] * (float)( Device_blk.Str.TemperInt[i] - t ); - //r. Îòëàäêà - //r. TermoCompens_Curr = 1.111111125; // îòëàäêà - //r.TermoCompens_Curr = // 0.25; // çà 1 ñåê íàêàïëèâàåòñÿ 2500 èìïóëüñîâ + //r. ������� + //r. TermoCompens_Curr = 1.111111125; // ������� + //r.TermoCompens_Curr = // 0.25; // �� 1 ��� ������������� 2500 ��������� /*r. - //0.000100; // êîýôô., ïðè êîòîðîì çà 1 ñåê íàêàïëèâàåòñÿ 1 èìïóëüñ - //1.0001; // êîýôô., ïðè êîòîðîì çà 1 ñåê íàêàïëèâàåòñÿ 10001 èìïóëüñ - // 0.000125; // êîýôô., ïðè êîòîðîì çà 1 ñåê íàêàïëèâàåòñÿ 1.25 èìïóëüñà (çà 100 âûâîäèòñÿ 122 èìï.???) - // 0.000105; // çà 100 ñåê ä.íàêàïëèâàòüñÿ 105 èìï., íàêàïë. 103??? + //0.000100; // �����., ��� ������� �� 1 ��� ������������� 1 ������� + //1.0001; // �����., ��� ������� �� 1 ��� ������������� 10001 ������� + // 0.000125; // �����., ��� ������� �� 1 ��� ������������� 1.25 �������� (�� 100 ��������� 122 ���.???) + // 0.000105; // �� 100 ��� �.������������� 105 ���., ������. 103??? */ - // TermoCompens_Curr = LONG_2_FRACT_14_18(TermoCompens_Curr); //r. TermoCompens_Curr ïåðåâîäèì â ôîðìàò 14.18 + // TermoCompens_Curr = LONG_2_FRACT_14_18(TermoCompens_Curr); //r. TermoCompens_Curr ��������� � ������ 14.18 return TermoCompens_Curr; } // StaticTermoCompens @@ -113,7 +109,7 @@ ** Returned value: Thermocompensation addition ** ******************************************************************************/ -int DynamicDeltaCalc() //e. calculation the addition termocompensation for 1 reset //r. ðàñ÷åò äîáàâêè òåðìîêîìïåíñàöèè íà îäíî îáíóëåíèå +int DynamicDeltaCalc() //e. calculation the addition termocompensation for 1 reset //r. ������ ������� ���������������� �� ���� ��������� { int i, t; @@ -168,25 +164,25 @@ for (i=0; i<2; i++) { - //e. conversion of temperature values on ADC output //r. ïðåîáðàçîâàíèå çíà÷åíèé òåìïåðàòóðû íà âûõîäå ÀÖÏ - //e. to range -32768 .. +32767 ( additional code; format 1.15 ) //r. ê äèàïàçîíó -32768 .. +32767 (äîïîëíèò. êîä; ôîðìàò 1.15) + //e. conversion of temperature values on ADC output //r. �������������� �������� ����������� �� ������ ��� + //e. to range -32768 .. +32767 ( additional code; format 1.15 ) //r. � ��������� -32768 .. +32767 (��������. ���; ������ 1.15) /* Output.Str.Tmp_Out[i] = mac_r(Device_blk.Str.Tmp_bias[i] << 16, (Input.StrIn.Tmp_in[i] - 0x8000), Device_blk.Str.Tmp_scal[i]);*/ Output.Str.Tmp_Out[i+4] = Input.StrIn.Tmp_in[i]; } - if (time_1_Sec == DEVICE_SAMPLE_RATE_uks) //r. èñòåêëà 1 ñåêóíäà + if (time_1_Sec == DEVICE_SAMPLE_RATE_uks) //r. ������� 1 ������� { seconds_aver++; } - if (seconds_aver > TEMP_AVER_PERIOD) //r. èñòåêëè TEMP_AVER_PERIOD(4 ñåêóíäû) ñåêóíä + if (seconds_aver > TEMP_AVER_PERIOD) //r. ������� TEMP_AVER_PERIOD(4 �������) ������ { seconds_aver = 0; TenSeconds++; - PrevTemp = Temp_Aver; //e. save the previous mean temperature for 1 Sec //r. çàïîìèíàåì ïðåäûäóùóþ ñðåäíþþ òåìïåðàòóðó çà ñåêóíäó - Temp_Aver = TS_sum / (DEVICE_SAMPLE_RATE_HZ * TEMP_AVER_PERIOD); //e. calculating mean temperature for 1 Sec //r. âû÷èñëÿåì ñðåäíþþ òåìïåðàòóðó çà ñåêóíäó + PrevTemp = Temp_Aver; //e. save the previous mean temperature for 1 Sec //r. ���������� ���������� ������� ����������� �� ������� + Temp_Aver = TS_sum / (DEVICE_SAMPLE_RATE_HZ * TEMP_AVER_PERIOD); //e. calculating mean temperature for 1 Sec //r. ��������� ������� ����������� �� ������� if (Temp_Aver > PrevTemp) { @@ -197,7 +193,7 @@ TempEvolution--; } - TS_sum = 0; //e. reset the sum for calculation of an mean //r. îáíóëÿåì ñóììó äëÿ âû÷èñëåíèÿ ñðåäíåãî + TS_sum = 0; //e. reset the sum for calculation of an mean //r. �������� ����� ��� ���������� �������� } else { @@ -219,32 +215,32 @@ TempEvolution = 0; } - //e. single calculaiton of some device parameters (measurement on the VALID_START_SEC second after start) //r. îäíîêðàòíûé ðàñ÷åò íåêîòîðûõ ïàðàìåòðîâ ïðèáîðà (èçìåðåíèå íà VALID_START_SEC ñåêóíäå ïîñëå ñòàðòà) + //e. single calculaiton of some device parameters (measurement on the VALID_START_SEC second after start) //r. ����������� ������ ��������� ���������� ������� (��������� �� VALID_START_SEC ������� ����� ������) if (StartRdy) { if (TenSeconds > VALID_START_4SEC) { - StartRdy = 0; //r. ñàìîáëîêèðîâêà, ïîýòîìó áîëüøå ñþäà íå çàõîäèì + StartRdy = 0; //r. ��������������, ������� ������ ���� �� ������� if ((Device_blk.Str.TermoMode != TERMO_OFF) && \ (Device_blk.Str.TermoMode != TERMO_ON_DYNAMIC_ONLY) && \ - (Device_blk.Str.TermoMode != TERMO_ON_DYNAMIC_ONLY_NUMB_OFF)) //r. ñòàòè÷åñêàÿ òåðìîêîìïåíñàöèÿ âêëþ÷åíà + (Device_blk.Str.TermoMode != TERMO_ON_DYNAMIC_ONLY_NUMB_OFF)) //r. ����������� ���������������� �������� { - //r. ðàñ÷åò ñòàòè÷åñêîé òåðìîêîìïåíñàöèè ÷èñëà - StartTermoCompens = StaticTermoCompens(Temp_Aver); //r. ñòàðòîâàÿ òåìïåðàòóðû ïðèáîðà + //r. ������ ����������� ���������������� ����� + StartTermoCompens = StaticTermoCompens(Temp_Aver); //r. ��������� ����������� ������� } DynamicDeltaCalc(); - //r. ðàñ÷åò ãðàíèö äëÿ ÷àñòîòû âèáðîïðèâîäà, çàâèñÿùåãî îò ñòàðòîâîé òåìïåðàòóðû + //r. ������ ������ ��� ������� ������������, ���������� �� ��������� ����������� // DithFreqRangeCalc(); - //r. êîýôôèöèåíòû äëÿ ïîëîñîâîãî ôèëüòðà êâàçè ÄÓÏ íå ïåðåñ÷èòûâàåì: ñ÷èòàåì, ÷òî ïîëîñà ôèëüòðà çàâåäîìî øèðå + //r. ������������ ��� ���������� ������� ����� ��� �� �������������: �������, ��� ������ ������� �������� ���� - //r. íàïðÿæåíèå ñáðîñà ïðè íàãðåâàíèè + //r. ���������� ������ ��� ���������� WP_reset_heating = CPL_reset_calc(Device_blk.Str.WP_reset, Device_blk.Str.K_WP_rst_heating, Temp_Aver, Device_blk.Str.TemperNormal); - //e. voltage of reset at cooling //r. íàïðÿæåíèå ñáðîñà ïðè îõëàæäåíèè + //e. voltage of reset at cooling //r. ���������� ������ ��� ���������� WP_reset_cooling = CPL_reset_calc(Device_blk.Str.WP_reset2, Device_blk.Str.K_WP_rst_cooling, Temp_Aver, Device_blk.Str.TemperNormal); } } @@ -253,7 +249,7 @@ { Temp_AverPrevDynCalc = Temp_Aver; DynamicDeltaCalc(); - }//r. ðàñ÷åò ñðåäíåé çà 1 ñåêóíäó òåìïåðàòóðû äàò÷èêîâ T4, T5 + }//r. ������ ������� �� 1 ������� ����������� �������� T4, T5 // cyclic built-in test 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) ) @@ -277,14 +273,14 @@ ** Returned value: None ** ******************************************************************************/ -void DithFreqRangeCalc(void) //r. ðàñ÷åò ãðàíèö êîýôôèöèåíòà äåëåíèÿ äëÿ ÷àñòîòû âèáðîïðèâîäà, çàâèñÿùèõ îò òåêóùåé òåìïåðàòóðû +void DithFreqRangeCalc(void) //r. ������ ������ ������������ ������� ��� ������� ������������, ��������� �� ������� ����������� { unsigned int min_level, max_level; int delta_VB_N; delta_VB_N = mult_r(Device_blk.Str.K_vb_tu >> DITH_VBN_SHIFT, (Temp_Aver - Device_blk.Str.TemperNormal)); //r.200; - //r. !!! ñäåëàòü ñóììèðîâàíèå ñ íàñûùåíèåì, à çàòåì ñäâèã + //r. !!! ������� ������������ � ����������, � ����� ����� min_level = VB_Nmin0 + delta_VB_N; max_level = VB_Nmax0 + delta_VB_N; // maximum saturation for unsigned levels
--- a/commandset.c Sat Jan 30 13:00:39 2016 +0000 +++ b/commandset.c Sat Jan 30 13:53:19 2016 +0000 @@ -1,74 +1,74 @@ + + + #include <string.h> -#include "commandset.h" -#include "el_lin.h" -#include "CyclesSync.h" -#include "CntrlGLD.h" -#include "InputOutput.h" -#include "Parameters.h" + + +#include "Global.h" #define COMMAND_DEBUG //++++++++++++++++debug++++++++++++++++ extern uint32_t In_Flag; unsigned char BuffTemp1[100]; -//e. +++++++++++++++++++ variables +++++++++++++++++++++++++++++++++++++++++++ //r. +++++++++++++++++++ ïåðåìåííûå +++++++++++++++++++++++++++++++++++++++++++ -uint32_t CMD_Mode = 0; //e. operation mode of the device //r. ðåæèì ðàáîòû óñòðîéñòâà -uint32_t CMD_Code; //e. full code of the last recieved command //r. ïîëíûé êîä ïîñëåäíåé ïðèíÿòîé êîìàíäû -uint32_t wrk_period; //e. run period in cycles //r. ðàáî÷èé ïåðèîä â öèêëàõ +//e. +++++++++++++++++++ variables +++++++++++++++++++++++++++++++++++++++++++ //r. +++++++++++++++++++ ���������� +++++++++++++++++++++++++++++++++++++++++++ +uint32_t CMD_Mode = 0; //e. operation mode of the device //r. ����� ������ ���������� +uint32_t CMD_Code; //e. full code of the last recieved command //r. ������ ��� ��������� �������� ������� +uint32_t wrk_period; //e. run period in cycles //r. ������� ������ � ������ uint32_t blt_in_test; - int32_t ScopeMode; //e. mode of display for a control point of an scope //r. ðåæèì îòîáðàæåíèÿ äëÿ êîíòðîëüíîé òî÷êè îñöèëëîãðàôà + int32_t ScopeMode; //e. mode of display for a control point of an scope //r. ����� ����������� ��� ����������� ����� ������������ -void SetSpeedPeriod(void) //e.============ procedure of set of rate and periodicity of answer ======== //r.============ ïðîöåäóðà óñòàíîâêè ñêîðîñòè è ïåðèîäè÷íîñòè îòâåòà ======== +void SetSpeedPeriod(void) //e.============ procedure of set of rate and periodicity of answer ======== //r.============ ��������� ��������� �������� � ������������� ������ ======== { - if ((rcv_buf[3] & 0x0080) != 0) //e. is periodic data transmission needed? //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à òðóáóåòñÿ? + if ((rcv_buf[3] & 0x0080) != 0) //e. is periodic data transmission needed? //r. ������������� �������� ���������? { - trm_cycl = 1; //e. yes, set present flag //r. äà, óñòàíîâèòü äàííûé ôëàã + trm_cycl = 1; //e. yes, set present flag //r. ��, ���������� ������ ���� } else { - trm_cycl = 0; //e. no, reset present flag //r. íåò, ñáðîñèòü äàííûé ôëàã + trm_cycl = 0; //e. no, reset present flag //r. ���, �������� ������ ���� } - SRgR &= 0xffcf; //e. clear the bit of transfer rate //r. î÷èñòêà áèò ñêîðîñòè ïåðåäà÷è + SRgR &= 0xffcf; //e. clear the bit of transfer rate //r. ������� ��� �������� �������� trm_rate = (rcv_buf[3] >> 1) & 0x0030; - SRgR |= trm_rate; //e. set present transfer rate //r. óñòàíîâèòü äàííóþ ñêîðîñòü ïåðåäà÷è + SRgR |= trm_rate; //e. set present transfer rate //r. ���������� ������ �������� �������� } // SetSpeedPeriod -void B_Delta_BINS(void) //r.===ïðîöåäóðà âûäà÷è íàêîïëåííûõ ðàçíîñòåé ñ÷åò÷èêîâ èìïóëüñîâ â ÈÍÑ â ôîðìàòå 14.18 +void B_Delta_BINS(void) //r.===��������� ������ ����������� ��������� ��������� ��������� � ��� � ������� 14.18 { Valid_Data = 0; // reset all bits of status word - num_of_par = 2; //e. 2 parameters output //r. âûâîäèòü 2 ïàðàìåòðà - addr_param[0] = &Output.Str.BINS_dif; //e. set the first parameter address //r. çàäàòü àäðåñ ïåðâîãî ïàðàìåòðà - addr_param[1] = &Valid_Data; //e. set the second paremeter address //r. çàäàòü àäðåñ âòîðîãî ïàðàìåòðà - size_param[0] = 4; //e. the length of the 1st parameter is 4 bytes //r. ïàðàìåòð 1 èìåeò äëèíó 4 áàéòà - size_param[1] = 1; //e. the length of the 2nd parameter is 1 byte (!! - the high byte, instead of low is transmitted) //r. ïàðàìåòð 2 èìååò äëèíó 1 áàéò (!!! ïåðåäàåòñÿ ñòàðøèé áàéò, à íå ìëàäøèé) - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + num_of_par = 2; //e. 2 parameters output //r. �������� 2 ��������� + addr_param[0] = &Output.Str.BINS_dif; //e. set the first parameter address //r. ������ ����� ������� ��������� + addr_param[1] = &Valid_Data; //e. set the second paremeter address //r. ������ ����� ������� ��������� + size_param[0] = 4; //e. the length of the 1st parameter is 4 bytes //r. �������� 1 ���e� ����� 4 ����� + size_param[1] = 1; //e. the length of the 2nd parameter is 1 byte (!! - the high byte, instead of low is transmitted) //r. �������� 2 ����� ����� 1 ���� (!!! ���������� ������� ����, � �� �������) + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� } // B_Delta_BINS -void B_Delta_SF(void) //r.=== ïðîöåäóðà äëÿ èçìåðåíèÿ ìàñøòàáíîãî ìíîæèòåëÿ +void B_Delta_SF(void) //r.=== ��������� ��� ��������� ����������� ��������� { - //e. time for data transfer has come, we work only with dither counters //r. ïðèøëî âðåìÿ ïåðåäàâàòü äàííûå, ðàáîòàåì òîëüêî ñ âèáðî-ñ÷åò÷èêàìè - RgConB = RATE_VIBRO_1; //e. set in the additional register of device control the mode of work with dither counters and the filter of moving average //r. óñòàíàâëèâàåì â äîïîëíèòåëüíîì ðåãèñòðå óïðàâëåíèÿ ðåæèì ðàáîòû ñ âèáðîñ÷åò÷èêàìè è ôèëüòðîì ñêîëüçÿùåãî ñðåäíåãî + //e. time for data transfer has come, we work only with dither counters //r. ������ ����� ���������� ������, �������� ������ � �����-���������� + RgConB = RATE_VIBRO_1; //e. set in the additional register of device control the mode of work with dither counters and the filter of moving average //r. ������������� � �������������� �������� ���������� ����� ������ � ��������������� � �������� ����������� �������� Valid_Data = 0; // reset all bits of status word - num_of_par = 5;//8; //e. 8 parameters output //r. âûâîäèòü 8 ïàðàìåòðà - addr_param[0] = &Output.Str.SF_dif; //e. set the first parameter address //r. çàäàòü àäðåñ ïåðâîãî ïàðàìåòðà - addr_param[1] = &Out_main_cycle_latch; //e. set the second paremeter address //r. çàäàòü àäðåñ âòîðîãî ïàðàìåòðà + num_of_par = 5;//8; //e. 8 parameters output //r. �������� 8 ��������� + addr_param[0] = &Output.Str.SF_dif; //e. set the first parameter address //r. ������ ����� ������� ��������� + addr_param[1] = &Out_main_cycle_latch; //e. set the second paremeter address //r. ������ ����� ������� ��������� addr_param[2] = &Out_T_latch;//F_ras; addr_param[3] = &Output.Str.WP_reg; addr_param[4] = &Output.Str.Tmp_Out; - size_param[0] = 8; //e. the length of the 1st parameter is 4 bytes //r. ïàðàìåòð 1 èìåeò äëèíó 4 áàéòà - size_param[1] = 4; //e. the length of the 2nd parameter is 1 byte (!! - the high byte, instead of low is transmitted) //r. ïàðàìåòð 2 èìååò äëèíó 1 áàéò (!!! ïåðåäàåòñÿ ñòàðøèé áàéò, à íå ìëàäøèé) + size_param[0] = 8; //e. the length of the 1st parameter is 4 bytes //r. �������� 1 ���e� ����� 4 ����� + size_param[1] = 4; //e. the length of the 2nd parameter is 1 byte (!! - the high byte, instead of low is transmitted) //r. �������� 2 ����� ����� 1 ���� (!!! ���������� ������� ����, � �� �������) size_param[2] = 2; size_param[3] = 2; size_param[4] = 12; - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� } // B_Delta_SF void B_Delta_PS_execution(void) @@ -94,12 +94,12 @@ Valid_Data = 0; // reset all bits of status word - num_of_par = 2; //e. 2 parameters output //r. âûâîäèòü 2 ïàðàìåòðà - addr_param[0] = &Output.Str.PS_dif; //e. set the first parameter address //r. çàäàòü àäðåñ ïåðâîãî ïàðàìåòðà + num_of_par = 2; //e. 2 parameters output //r. �������� 2 ��������� + addr_param[0] = &Output.Str.PS_dif; //e. set the first parameter address //r. ������ ����� ������� ��������� addr_param[1] = ¶mTmpWord; - size_param[0] = 2; //e. the 1st parameter has 2 bytes length //r. ïàðàìåòð 1 èìåeò äëèíó 2 áàéò - size_param[1] = 2; //e. the 2nd and 3rd parameters have 1 bytes length//r. ïàðàìåòðû 2,3 èìåþò äëèíó 1 áàéò - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + size_param[0] = 2; //e. the 1st parameter has 2 bytes length //r. �������� 1 ���e� ����� 2 ���� + size_param[1] = 2; //e. the 2nd and 3rd parameters have 1 bytes length//r. ��������� 2,3 ����� ����� 1 ���� + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� index++; if (index > 21) @@ -108,45 +108,45 @@ } } // B_Delta_PS_execution -void M_Mirror(void) //e.---------------- prepare to transmission of the copy of receiving buffer ------------- //r.---------------- ïîäãîòîâêà ïåðåäà÷è êîïèè ïðèåìíîãî áóôåðà ------------- +void M_Mirror(void) //e.---------------- prepare to transmission of the copy of receiving buffer ------------- //r.---------------- ���������� �������� ����� ��������� ������ ------------- { - num_of_par = 1; //e. 1 parameter output //r. âûâîäèòü 1 ïàðàìåòð + num_of_par = 1; //e. 1 parameter output //r. �������� 1 �������� - addr_param[0] = &rcv_copy; //e. set the address of the receiving buffer //r. óñòàíîâêà àäðåñà ïðèåìíîãî áóôåðà + addr_param[0] = &rcv_copy; //e. set the address of the receiving buffer //r. ��������� ������ ��������� ������ - //e. multiply the number of copied words on 2, since each //r. óìíîæèòü ÷èñëî ñêîïèðîâàííûõ ñëîâ íà 2, ò.ê. êàæäîå - //e. will be trasferred in two steps: first zero, and then //r. áóäåò ïåðåäàâàòüñ÷ â äâà ïðèåìà: ñíà÷àëà íóëåâîé, à çàòåì + //e. multiply the number of copied words on 2, since each //r. �������� ����� ������������� ���� �� 2, �.�. ������ + //e. will be trasferred in two steps: first zero, and then //r. ����� ������������ � ��� ������: ������� �������, � ����� size_param[0] = rcv_byt_copy << 1; // multiplay by 2 if (size_param[0] >= 64) { - size_param[0] = 64; //e. maximal amount - no more than double length of the copy buffer //r. ìàêñèìàëüíîå êîëè÷åñòâî - íå áîëåå äâîéíîé äëèíû áóôåðà-êîïèè + size_param[0] = 64; //e. maximal amount - no more than double length of the copy buffer //r. ������������ ���������� - �� ����� ������� ����� ������-����� } - trm_rate = 0; //e. set the transfer rate to the 38400 bauds //r. óñòàíîâèòü ñêîðîñòü ïåðåäà÷è 38400 áîä - trm_cycl = 0; //e. forbid cyclic transmission of the parameter //r. çàïðåòèòü ïåðåäà÷ó ïàðàìåòðà â öèêëå - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + trm_rate = 0; //e. set the transfer rate to the 38400 bauds //r. ���������� �������� �������� 38400 ��� + trm_cycl = 0; //e. forbid cyclic transmission of the parameter //r. ��������� �������� ��������� � ����� + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� } // M_Mirror -void Mk_Ask1(void) //r.----------------- prepare of the standart answer 1 ---------------------- //r.----------------- ïîäãîòîâêà ñòàíäàðòíîãî îòâåòà 1 ---------------------- +void Mk_Ask1(void) //r.----------------- prepare of the standart answer 1 ---------------------- //r.----------------- ���������� ������������ ������ 1 ---------------------- { - CMD_Code &= 0xff00; //e. clear bits of errors //r. î÷èñòèòü â íåì ïîëå îøèáîê - num_of_par = 1; //e. total amount parameters in aswer - 1 //r. âñåãî ïàðàìåòðîâ â îòâåòå - 1 - addr_param[0] = &CMD_Code; //e. and this parameter - returnable command code //r. è ýòîò ïàðàìåòð - âîçâðàùàåìûé êîä êîìàíäû - size_param[0] = 2; //e. and both its bytes //r. ïðè÷åì îáà åãî áàéòà - trm_ena = 1; //e. allow operation of the transmitter of the device //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà óñòðîéñòâà + CMD_Code &= 0xff00; //e. clear bits of errors //r. �������� � ��� ���� ������ + num_of_par = 1; //e. total amount parameters in aswer - 1 //r. ����� ���������� � ������ - 1 + addr_param[0] = &CMD_Code; //e. and this parameter - returnable command code //r. � ���� �������� - ������������ ��� ������� + size_param[0] = 2; //e. and both its bytes //r. ������ ��� ��� ����� + trm_ena = 1; //e. allow operation of the transmitter of the device //r. ��������� ������ ����������� ���������� } // Mk_Ask1 -void Mk_AskDev(void) //r.----------------- answer on a command for device mode set ------------ //r.----------------- Îòâåò íà êîìàíäó óñòàíîâêè ðåæèìà ïðèáîðà ------------ +void Mk_AskDev(void) //r.----------------- answer on a command for device mode set ------------ //r.----------------- ����� �� ������� ��������� ������ ������� ------------ { - num_of_par = 2; //e. 2 parameters output //r. âûâîäèòü äâà ïàðàìåòðà - addr_param[0] = &Device_Mode; //e. address of the counter mode register (intenal latch, external latch, etc.) //r. àäðåñ ðåãèñòðà ðåæèìà ñ÷åò÷èêîâ (âíóòð., âíåøíÿÿ çàùåëêà è ò.ä.) - addr_param[1] = &SRgR; //e. address of the mode register of the processor card //r. àäðåñ ðåãèñòðà ðåæèìà ïëàòû ïðîöåññîðà - size_param[0] = 2; //e. size of the counter mode register - 2 bytes //r. ðàçìåð ðåãèñòðà ðåæèìà ñ÷åò÷èêîâ - 2 áàéòà - size_param[1] = 2; //e. size of the mode register of the processor card //r. ðàçìåð ðåãèñòðà ðåæèìà ïëàòû ïðîöåññîðà - trm_cycl = 0; //e. forbid cyclic transmission of the parameter //r. çàïðåòèòü ïåðåäà÷ó ïàðàìåòðà â öèêëå - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + num_of_par = 2; //e. 2 parameters output //r. �������� ��� ��������� + addr_param[0] = &Device_Mode; //e. address of the counter mode register (intenal latch, external latch, etc.) //r. ����� �������� ������ ��������� (�����., ������� ������� � �.�.) + addr_param[1] = &SRgR; //e. address of the mode register of the processor card //r. ����� �������� ������ ����� ���������� + size_param[0] = 2; //e. size of the counter mode register - 2 bytes //r. ������ �������� ������ ��������� - 2 ����� + size_param[1] = 2; //e. size of the mode register of the processor card //r. ������ �������� ������ ����� ���������� + trm_cycl = 0; //e. forbid cyclic transmission of the parameter //r. ��������� �������� ��������� � ����� + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� } // Mk_AskDev -void GLD_Output(void) //e. ----------- Output modes --------- //r. --------- Ðåæèìû âûâîäà --------- +void GLD_Output(void) //e. ----------- Output modes --------- //r. --------- ������ ������ --------- { if (Latch_Rdy) //latch appeared { @@ -160,8 +160,8 @@ break; case 5: - CMD_Code &= 0xff1f; //e. reset bits of current command code settings of periodicity and transfer rate //r. ñáðîñèòü â òåêóùåì êîäå êîìàíäû áèòû óñòàíîâêè ïåðèîäè÷íîñòè è ñêîðîñòè ïåðåäà÷è - if (CMD_Code == 0xdd02) //e. is it the Rate2 mode? //r. ýòî ðåæèì Rate2? + CMD_Code &= 0xff1f; //e. reset bits of current command code settings of periodicity and transfer rate //r. �������� � ������� ���� ������� ���� ��������� ������������� � �������� �������� + if (CMD_Code == 0xdd02) //e. is it the Rate2 mode? //r. ��� ����� Rate2? { if (data_Rdy & WHOLE_PERIOD) { @@ -178,15 +178,15 @@ ///// -------- commands ------------------------------------------------------------- -//e. set main device operation modes: //r. Óñòàíîâêà îñíîâíûõ ðåæèìîâ ðàáîòû ïðèáîðà: -//e. 1. acions with counters (internal latch, external latch with request over line, //r. 1. ðàáîòà ñî ñ÷åò÷èêàìè (âíóòðåííÿÿ çàùåëêà, âíåøíÿÿ çàùåëêè ñ çàïðîñîì ïî ëèíèè, -//e. external latch without request over line (instant answer after receiving of external latch pulse)) //r. âíåøíÿÿ çàùåëêà áåç çàïðîñà ïî ëèíèè (îòâåò ñðàçó ïîñëå ïðèõîäà èìïóëüñà âíåøí. çàùåëêè)) -//e. 2. line receiving/transmission rate //r. 2. ñêîðîñòü ïðèåìà/ïåðåäà÷è ïî ëèíèè +//e. set main device operation modes: //r. ��������� �������� ������� ������ �������: +//e. 1. acions with counters (internal latch, external latch with request over line, //r. 1. ������ �� ���������� (���������� �������, ������� ������� � �������� �� �����, +//e. external latch without request over line (instant answer after receiving of external latch pulse)) //r. ������� ������� ��� ������� �� ����� (����� ����� ����� ������� �������� �����. �������)) +//e. 2. line receiving/transmission rate //r. 2. �������� ������/�������� �� ����� void B_Dev_Mode(void) { - Device_Mode = rcv_buf[3] & 0x00ff; //e. read the byte of command parameter from the receiver buffer //r. ñ÷èòàòü èç áóôåðà ïðèåìíèêà áàéò ïàðàìåòðà êîìàíäû - //e. and write it to the counter mode register //r. è çàïèñûâàåì â ðåãèñòð ðåæèìà ñ÷åò÷èêîâ - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + Device_Mode = rcv_buf[3] & 0x00ff; //e. read the byte of command parameter from the receiver buffer //r. ������� �� ������ ��������� ���� ��������� ������� + //e. and write it to the counter mode register //r. � ���������� � ������� ������ ��������� + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_AskDev(); } // B_Dev_Mode @@ -207,154 +207,154 @@ { Is_BIT = 0; } - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_AskDev(); } // B_BIT_Mode -void M_Stimul(void) //e. === procedure of output of analog (DAC) and digital (flags) stimuluses //r. === ïðîöåäóðà âûâîäà àíàëîãîâûõ (ÖÀÏ) è äèñêðåòíûõ (ôëàãè) ñòèìóëîâ +void M_Stimul(void) //e. === procedure of output of analog (DAC) and digital (flags) stimuluses //r. === ��������� ������ ���������� (���) � ���������� (�����) �������� { uint32_t chan; - ScopeMode = 4; //e. WP_PHASE_DETECTOR allocate a mode of display for a control point of an scope //r. WP_PHASE_DETECTOR íàçíà÷èòü ðåæèì îòîáðàæåíèÿ äëÿ êîíòðîëüíîé òî÷êè îñöèëëîãðàôà + ScopeMode = 4; //e. WP_PHASE_DETECTOR allocate a mode of display for a control point of an scope //r. WP_PHASE_DETECTOR ��������� ����� ����������� ��� ����������� ����� ������������ - chan = CMD_Code & 0x0007; //e. extracting the number of stimulus //r. âûäåëåíèå íîìåðà ñòèìóëà + chan = CMD_Code & 0x0007; //e. extracting the number of stimulus //r. ��������� ������ ������� Output.ArrayOut[chan] = (((int)rcv_buf[4] << 8) | (int)rcv_buf[5])-0x8000; - if ((CMD_Code & (1 << 7)) == 0) //e. to estimate: whether the answer is required //r. îöåíèòü: òðåáóåòñÿ ëè îòâåò + if ((CMD_Code & (1 << 7)) == 0) //e. to estimate: whether the answer is required //r. �������: ��������� �� ����� { - return; //e. if no - return //r. åñëè íåò - âîçâðàò + return; //e. if no - return //r. ���� ��� - ������� } - Mk_Ask1(); //e. otherwise - answer output //r. èíà÷å - âûäàòü îòâåò + Mk_Ask1(); //e. otherwise - answer output //r. ����� - ������ ����� } // M_Stymul -void M_Status(void) //e. === procedure of initialization of transmission of the device status //r. === ïðîöåäóðà èíèöèàëèçàöèè ïåðåäà÷è ñòàòóñà óñòðîéñòâà +void M_Status(void) //e. === procedure of initialization of transmission of the device status //r. === ��������� ������������� �������� ������� ���������� { - SetSpeedPeriod(); //e. and set the answer transfer rate and its periodicity //r. è óñòàíîâèòü ñêîðîñòü ïåðåäà÷è îòâåòà è åãî ïåðèîäè÷íîñòü + SetSpeedPeriod(); //e. and set the answer transfer rate and its periodicity //r. � ���������� �������� �������� ������ � ��� ������������� - num_of_par = 2; //e. 2 parameters output //r. âûâîäèòü äâà ïàðàìåòðà - addr_param[0] = &blt_in_test; //e. the register address of the self-testing result //r. àäðåñ ðåãèñòðà ðåçóëüòàòà ñàìîòåñòèðîâàíèÿ - addr_param[1] = &ser_num; //e. address of the register of errors of line //r. àäðåñ ðåãèñòðà îøèáîê ëèíèè - size_param[0] = 2; //e. size of the self-test register - 2 bytes //r. ðàçìåð ðåãèñòðà ñàìîòåñòèðîâàíèÿ - 2 áàéòà - size_param[1] = 2; //e. size of the register of errors of line //r. ðàçìåð ðåãèñòðà îøèáîê ëèíèè + num_of_par = 2; //e. 2 parameters output //r. �������� ��� ��������� + addr_param[0] = &blt_in_test; //e. the register address of the self-testing result //r. ����� �������� ���������� ���������������� + addr_param[1] = &ser_num; //e. address of the register of errors of line //r. ����� �������� ������ ����� + size_param[0] = 2; //e. size of the self-test register - 2 bytes //r. ������ �������� ���������������� - 2 ����� + size_param[1] = 2; //e. size of the register of errors of line //r. ������ �������� ������ ����� - trm_rate = 0; //e. set the transfer rate to the 38400 bauds //r. óñòàíîâèòü ñêîðîñòü ïåðåäà÷è 38400 áîä - trm_cycl = 0; //e. forbid cyclic transmission of the parameter //r. çàïðåòèòü ïåðåäà÷ó ïàðàìåòðà â öèêëå - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + trm_rate = 0; //e. set the transfer rate to the 38400 bauds //r. ���������� �������� �������� 38400 ��� + trm_cycl = 0; //e. forbid cyclic transmission of the parameter //r. ��������� �������� ��������� � ����� + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� } // M_Status -void M_Clear(void) //e.---------------- cleaning of the register of errors of line -------------------------- //r.---------------- î÷èñòêà ðåãèñòðà îøèáîê ëèíèè -------------------------- +void M_Clear(void) //e.---------------- cleaning of the register of errors of line -------------------------- //r.---------------- ������� �������� ������ ����� -------------------------- { line_err = 0; } // M_Clear -void M_Tmp_W(void) //e.----------------- write the command to the AD7714 IC ------------------------- //r.----------------- çàïèñü êîìàíäû â ñõåìû AD7714 ------------------------- +void M_Tmp_W(void) //e.----------------- write the command to the AD7714 IC ------------------------- //r.----------------- ������ ������� � ����� AD7714 ------------------------- { Mk_Ask1(); } -void M_Tmp_R(void) //e.----------------- read the data from the AD7714 IC -------------------------- //r.----------------- ÷òåíèå äàííûõ èç ñõåì AD7714 -------------------------- +void M_Tmp_R(void) //e.----------------- read the data from the AD7714 IC -------------------------- //r.----------------- ������ ������ �� ���� AD7714 -------------------------- { } // M_Tmp_R -void M_ADC_R(void) //e.----------------- read the data from the ADCs ADS1250, ADS8321 --------- //r.----------------- ÷òåíèå äàííûõ èç êàíàëîâ ÀÖÏ ADS1250, ADS8321 --------- +void M_ADC_R(void) //e.----------------- read the data from the ADCs ADS1250, ADS8321 --------- //r.----------------- ������ ������ �� ������� ��� ADS1250, ADS8321 --------- { - SetSpeedPeriod(); //e. set the answer transfer rate and its periodicity //r. óñòàíîâèòü ñêîðîñòü ïåðåäà÷è îòâåòà è åãî ïåðèîäè÷íîñòü + SetSpeedPeriod(); //e. set the answer transfer rate and its periodicity //r. ���������� �������� �������� ������ � ��� ������������� UART_SwitchSpeed(trm_rate); - num_of_par = 4; //e. 4 parameters output //r. âûâîäèòü ÷åòûðå ïàðàìåòðà - addr_param[0] = 0; //e. //r. <!-- èñïîëüçîâàëèñü äëÿ ÄÓÏ, òåïåðü íå èñïîëüçóþòñÿ + num_of_par = 4; //e. 4 parameters output //r. �������� ������ ��������� + addr_param[0] = 0; //e. //r. <!-- �������������� ��� ���, ������ �� ������������ addr_param[1] = 0; //e. //r. --> addr_param[2] = 0; - addr_param[3] = &(Input.StrIn.HF_out); //e. set the 4th parameter address _HF_out //r. çàäàòü àäðåñ ÷åòâåðòîãî ïàðàìåòðà _HF_out - size_param[0] = 2; //e. size of the parameters - 2 bytes //r. ðàçìåð ïàðàìåòðîâ - 2 áàéòà + addr_param[3] = &(Input.StrIn.HF_out); //e. set the 4th parameter address _HF_out //r. ������ ����� ���������� ��������� _HF_out + size_param[0] = 2; //e. size of the parameters - 2 bytes //r. ������ ���������� - 2 ����� size_param[1] = 2; size_param[2] = 2; size_param[3] = 2; - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� } // M_ADC_R -void M_Cnt_R(void) //r.----------------- read the counters of the Elio5 card -------------------------- //r.----------------- ÷òåíèå ñ÷åò÷èêîâ ïëàòû Elio5 -------------------------- +void M_Cnt_R(void) //r.----------------- read the counters of the Elio5 card -------------------------- //r.----------------- ������ ��������� ����� Elio5 -------------------------- { - SetSpeedPeriod(); //e. set the answer transfer rate and its periodicity //r. óñòàíîâèòü ñêîðîñòü ïåðåäà÷è îòâåòà è åãî ïåðèîäè÷íîñòü + SetSpeedPeriod(); //e. set the answer transfer rate and its periodicity //r. ���������� �������� �������� ������ � ��� ������������� UART_SwitchSpeed(trm_rate); - num_of_par = 2; //e. 2 parameters output //r. âûâîäèòü äâà ïàðàìåòðà + num_of_par = 2; //e. 2 parameters output //r. �������� ��� ��������� - addr_param[0] = &(Output.Str.Cnt_Pls); //e. set the first parameter address //r. çàäàòü àäðåñ ïåðâîãî ïàðàìåòðà - addr_param[1] = &(Output.Str.Cnt_Mns); //e. set the second paremeter address //r. çàäàòü àäðåñ âòîðîãî ïàðàìåòðà - size_param[0] = 2; //e. size of the parameters - 2 bytes //r. ðàçìåð ïàðàìåòðîâ - 2 áàéòà + addr_param[0] = &(Output.Str.Cnt_Pls); //e. set the first parameter address //r. ������ ����� ������� ��������� + addr_param[1] = &(Output.Str.Cnt_Mns); //e. set the second paremeter address //r. ������ ����� ������� ��������� + size_param[0] = 2; //e. size of the parameters - 2 bytes //r. ������ ���������� - 2 ����� size_param[1] = 2; - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� } // M_Cnt_R -/*void M_e5r_W(void) //r.----------------- write to the mode register of the Elio5 card ------------------ //r.----------------- çàïèñü â ðåãèñòð ðåæèìà ïëàòû Elio5 ------------------ +/*void M_e5r_W(void) //r.----------------- write to the mode register of the Elio5 card ------------------ //r.----------------- ������ � ������� ������ ����� Elio5 ------------------ { - //e. read the byte of command parameter from the receiver buffer //r. ñ÷èòàòü èç áóôåðà ïðèåìíèêà áàéò ïàðàìåòðà êîìàíäû - //e. and write it to the card mode register and its copy //r. è çàïèñàòü åãî â ðåãèñòð ðåæèìà ïëàòû è â åãî êîïèþ + //e. read the byte of command parameter from the receiver buffer //r. ������� �� ������ ��������� ���� ��������� ������� + //e. and write it to the card mode register and its copy //r. � �������� ��� � ������� ������ ����� � � ��� ����� #if !defined COMMAND_DEBUG Copy_e5_RgR = rcv_buf[3]; io_space_write(E5_RGR, Copy_e5_RgR); #endif - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_Ask1(); } // M_e5r_W */ /* -void M_e5rA_W(void) //e.----- write to the 1st additional mode register of the Elio5 card ---------- //r.----- çàïèñü â 1-ûé äîïîëíèòåëüíûé ðåãèñòð ðåæèìà ïëàòû Elio5 ---------- +void M_e5rA_W(void) //e.----- write to the 1st additional mode register of the Elio5 card ---------- //r.----- ������ � 1-�� �������������� ������� ������ ����� Elio5 ---------- { - //e. this command is used for switching a signal on which data counters are latched: //r. ýòà êîìàíäà èñïîëüçóåòñÿ äëÿ ïåðåêëþ÷åíèÿ ñèãíàëà, ïî êîòîðîìó çàùåëêèâàþòñÿ - //e. on the Reper signal or on Sign Meander //r. èíôîðìàöèîííûå ñ÷åò÷èêè: ëèáî ïî Reper`ó ëèáî ïî RefMeandr`ó + //e. this command is used for switching a signal on which data counters are latched: //r. ��� ������� ������������ ��� ������������ �������, �� �������� ������������� + //e. on the Reper signal or on Sign Meander //r. �������������� ��������: ���� �� Reper`� ���� �� RefMeandr`� - //e. read the byte of command parameter from the receiver buffer //r. ñ÷èòàòü èç áóôåðà ïðèåìíèêà áàéò ïàðàìåòðà êîìàíäû - //e. and write it to the card mode register and its copy //r. è çàïèñàòü åãî â ðåãèñòð ðåæèìà ïëàòû è â åãî êîïèþ + //e. read the byte of command parameter from the receiver buffer //r. ������� �� ������ ��������� ���� ��������� ������� + //e. and write it to the card mode register and its copy //r. � �������� ��� � ������� ������ ����� � � ��� ����� Copy_e5_RgRA = rcv_buf[3]; -//??? Device_Mode = Copy_e5_RgRA; //e. and write it to the counter mode register //r. è çàïèñûâàåì â ðåãèñòð ðåæèìà ñ÷åò÷èêîâ +//??? Device_Mode = Copy_e5_RgRA; //e. and write it to the counter mode register //r. � ���������� � ������� ������ ��������� #if !defined COMMAND_DEBUG io_space_write(E5_RGRA, Copy_e5_RgRA); #endif - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_Ask1(); } // M_e5rA_W */ -void M_Ctl_R(void) //r.----------------- reading the control register of the device ----------------- //r.----------------- ÷òåíèå ðåãèñòðà óïðàâëåíèÿ óñòðîéñòâà ----------------- +void M_Ctl_R(void) //r.----------------- reading the control register of the device ----------------- //r.----------------- ������ �������� ���������� ���������� ----------------- { - num_of_par = 2; //e. 2 parameters transfer //r. ïåðåäàâàòü 2 ïàðàìåòðà - addr_param[0] = &CMD_Code; //e. the first parameter in answer - returned command code //r. ïåðâûé ïàðàìåòð â îòâåòå - âîçâðàùàåìûé êîä êîìàíäû + num_of_par = 2; //e. 2 parameters transfer //r. ���������� 2 ��������� + addr_param[0] = &CMD_Code; //e. the first parameter in answer - returned command code //r. ������ �������� � ������ - ������������ ��� ������� size_param[0] = 2; - size_param[1] = 2; //e. two bytes also have control registers //r. äâà áàéòà èìåþò òàêæå è ðåãèñòðû óïðàâëåíèÿ - if ((rcv_buf[3] & (1 << 4)) == 0) //e. is main control register needed? //r. òðåáóåòñÿ îñíîâíîé ðåãèñòð óïðàâëåíèÿ? + size_param[1] = 2; //e. two bytes also have control registers //r. ��� ����� ����� ����� � �������� ���������� + if ((rcv_buf[3] & (1 << 4)) == 0) //e. is main control register needed? //r. ��������� �������� ������� ����������? { - addr_param[1] = &RgConA; //e. yes //r. äà + addr_param[1] = &RgConA; //e. yes //r. �� } else { - addr_param[1] = &RgConB; //e. otherwise - load the address of the addititonal register //r. èíà÷å - çàãðóçèòü àäðåñ äîïîëíèòåëüíîãî ðåãèñòðà + addr_param[1] = &RgConB; //e. otherwise - load the address of the addititonal register //r. ����� - ��������� ����� ��������������� �������� } - CMD_Code &= 0xff10; //e. clear in it bit of errors and byte number //r. ñáðîñèòü â íåì ïîëÿ îøèáîê è íîìåðà áèòà - trm_ena = 1; //e. allow operation of the transmitter of line //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà ëèíèè + CMD_Code &= 0xff10; //e. clear in it bit of errors and byte number //r. �������� � ��� ���� ������ � ������ ���� + trm_ena = 1; //e. allow operation of the transmitter of line //r. ��������� ������ ����������� ����� } // M_Ctl_R -void M_Ctl_M(void) //r.----------------- modification of the control register of the device ------------ //r.----------------- ìîäèôèêàöèÿ ðåãèñòðà óïðàâëåíèÿ óñòðîéñòâà ------------ +void M_Ctl_M(void) //r.----------------- modification of the control register of the device ------------ //r.----------------- ����������� �������� ���������� ���������� ------------ { uint32_t * ptr; uint32_t bit_numb; - num_of_par = 2; //e. 2 parameters transfer //r. ïåðåäàâàòü 2 ïàðàìåòðà - addr_param[0] = &CMD_Code; //e. the first parameter in answer - returned command code //r. ïåðâûé ïàðàìåòð â îòâåòå - âîçâðàùàåìûé êîä êîìàíäû + num_of_par = 2; //e. 2 parameters transfer //r. ���������� 2 ��������� + addr_param[0] = &CMD_Code; //e. the first parameter in answer - returned command code //r. ������ �������� � ������ - ������������ ��� ������� size_param[0] = 2; - size_param[1] = 2; //e. two bytes also have control registers //r. äâà áàéòà èìåþò òàêæå è ðåãèñòðû óïðàâëåíèÿ - if ((CMD_Code & (1 << 4)) == 0) //e. is main control register needed? //r. òðåáóåòñÿ îñíîâíîé ðåãèñòð óïðàâëåíèÿ? + size_param[1] = 2; //e. two bytes also have control registers //r. ��� ����� ����� ����� � �������� ���������� + if ((CMD_Code & (1 << 4)) == 0) //e. is main control register needed? //r. ��������� �������� ������� ����������? { - ptr = &RgConA; //e. yes //r. äà + ptr = &RgConA; //e. yes //r. �� } else { - ptr = &RgConB; //e. otherwise - load the address of the addititonal register //r. èíà÷å - çàãðóçèòü àäðåñ äîïîëíèòåëüíîãî ðåãèñòðà + ptr = &RgConB; //e. otherwise - load the address of the addititonal register //r. ����� - ��������� ����� ��������������� �������� } - addr_param[1] = ptr; //e. the second parameter in answer - modified register //r. âòîðîé ïàðàìåòð â îòâåòå - ìîäèôèöèðîâàííûé ðåãèñòð + addr_param[1] = ptr; //e. the second parameter in answer - modified register //r. ������ �������� � ������ - ���������������� ������� - bit_numb = CMD_Code & 0x000f; //e. extract the number of the changeable bit //r. âûäåëèòü íîìåð èçìåíÿåìîãî áèòà + bit_numb = CMD_Code & 0x000f; //e. extract the number of the changeable bit //r. �������� ����� ����������� ���� if ((CMD_Code & (1 << 7)) == 0) // Is clear bit { *ptr &= ~(1 << bit_numb); // yes, clear bit @@ -364,84 +364,84 @@ *ptr |= 1 << bit_numb; // no, set bit } - CMD_Code &= 0xff10; //e. clear in command bit of errors and byte number //r. ñáðîñèòü â êîìàíäå ïîëÿ îøèáîê è íîìåðà áèòà - trm_cycl = 0; //e. forbid cyclic transmission of the parameter //r. çàïðåòèòü ïåðåäà÷ó ïàðàìåòðà â öèêëå - trm_ena = 1; //e. allow operation of the transmitter of line //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà ëèíèè + CMD_Code &= 0xff10; //e. clear in command bit of errors and byte number //r. �������� � ������� ���� ������ � ������ ���� + trm_cycl = 0; //e. forbid cyclic transmission of the parameter //r. ��������� �������� ��������� � ����� + trm_ena = 1; //e. allow operation of the transmitter of line //r. ��������� ������ ����������� ����� } // M_Ctl_M -void M_Flg_R(void) //e.------------ reading the register of input flags --------------------------- //r.------------ ÷òåíèå ðåãèñòðà âõîäíûõ ôëàãîâ --------------------------- +void M_Flg_R(void) //e.------------ reading the register of input flags --------------------------- //r.------------ ������ �������� ������� ������ --------------------------- { - num_of_par = 1; //e. 1 parameter output //r. âûâîäèòü îäèí ïàðàìåòð - addr_param[0] = &In_Flag; //e. the address of the flag register copy //r. àäðåñ êîïèè ðåãèñòðà ôëàãîâ - size_param[0] = 2; //e. size of the buffer - 2 bytes //r. ðàçìåð áóôåðà - 2 áàéòà - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + num_of_par = 1; //e. 1 parameter output //r. �������� ���� �������� + addr_param[0] = &In_Flag; //e. the address of the flag register copy //r. ����� ����� �������� ������ + size_param[0] = 2; //e. size of the buffer - 2 bytes //r. ������ ������ - 2 ����� + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� } // M_Flg_R -void M_Vib_W(void) //r.------------ set the oscillation period of the dither drive ----------------- //r.------------ óñòàíîâêà ïåðèîäà êîëåáàíèé âèáðîïðèâîäà ----------------- +void M_Vib_W(void) //r.------------ set the oscillation period of the dither drive ----------------- //r.------------ ��������� ������� ��������� ������������ ----------------- { - ScopeMode = 1; //e. VB_PHASE_DETECTOR allocate a mode of display for a control point of an scope //r. VB_PHASE_DETECTOR íàçíà÷èòü ðåæèì îòîáðàæåíèÿ äëÿ êîíòðîëüíîé òî÷êè îñöèëëîãðàôà + ScopeMode = 1; //e. VB_PHASE_DETECTOR allocate a mode of display for a control point of an scope //r. VB_PHASE_DETECTOR ��������� ����� ����������� ��� ����������� ����� ������������ - Output.Str.T_Vibro = (rcv_buf[4] << 8) | (rcv_buf[5] & 0xFF); //e. new variable of the period //r. íîâàÿ ïåðåìåííàÿ ïåðèîäà + Output.Str.T_Vibro = (rcv_buf[4] << 8) | (rcv_buf[5] & 0xFF); //e. new variable of the period //r. ����� ���������� ������� /* sprintf(BuffTemp1, "\n\r F = %d ", Output.Str.T_Vibro); SendToBuff(BuffTemp1,15);*/ - Output.Str.L_Vibro= (rcv_buf[6] << 8) | (rcv_buf[7] & 0xFF); //e. new variable of the pulse width //r. íîâàÿ ïåðåìåííàÿ äëèòåëüíîñòè èìïóëüñîâ + Output.Str.L_Vibro= (rcv_buf[6] << 8) | (rcv_buf[7] & 0xFF); //e. new variable of the pulse width //r. ����� ���������� ������������ ��������� /*sprintf(BuffTemp1, "\n\r L = %d ", Output.Str.L_Vibro); SendToBuff(BuffTemp1,15);*/ - VibroDither_Set(); //e. and output its value to period registers on card //r. âûâåñòè åå çíà÷åíèå â ðåãèñòðû ïåðèîäà íà ïëàòå + VibroDither_Set(); //e. and output its value to period registers on card //r. ������� �� �������� � �������� ������� �� ����� - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_Ask1(); } // M_Vib_W -void M_Gph_W(void) //e.------------ set the gain factor of photodetector channels ------------------- //r.------------ óñòàíîâêà óñèëåíèÿ êàíàëîâ ôîòîïðèåìíèêà ------------------- +void M_Gph_W(void) //e.------------ set the gain factor of photodetector channels ------------------- //r.------------ ��������� �������� ������� ������������� ------------------- { - Device_blk.Str.Gain_Ph_A = rcv_buf[4]; //e. read from the receiver buffer the value of the gain factor of the A channel //r. ñ÷èòàòü èç áóôåðà ïðèåìíèêà çíà÷åíèå óñèëåíèÿ êàíàëà À - Device_blk.Str.Gain_Ph_B = rcv_buf[5]; //e. read from the receiver buffer the value of the gain factor of the B channel //r. ñ÷èòàòü èç áóôåðà ïðèåìíèêà çíà÷åíèå óñèëåíèÿ êàíàëà  + Device_blk.Str.Gain_Ph_A = rcv_buf[4]; //e. read from the receiver buffer the value of the gain factor of the A channel //r. ������� �� ������ ��������� �������� �������� ������ � + Device_blk.Str.Gain_Ph_B = rcv_buf[5]; //e. read from the receiver buffer the value of the gain factor of the B channel //r. ������� �� ������ ��������� �������� �������� ������ � - Out_G_photo(Device_blk.Str.Gain_Ph_A, Device_blk.Str.Gain_Ph_B); //e. display these values to digital potentiometers //r. âûâåñòè ýòè çíà÷åíèÿ â öèôðîâûå ïîòåíöèîìåòðû + Out_G_photo(Device_blk.Str.Gain_Ph_A, Device_blk.Str.Gain_Ph_B); //e. display these values to digital potentiometers //r. ������� ��� �������� � �������� ������������� - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_Ask1(); } // M_Gph_W -void M_Rate(void) //e.------------ start of transfer of the M_Rate parameters stack ------------------- //r.------------ çàïóñê ïåðåäà÷è íàáîðà ïàðàìåòðîâ M_Rate ------------------- +void M_Rate(void) //e.------------ start of transfer of the M_Rate parameters stack ------------------- //r.------------ ������ �������� ������ ���������� M_Rate ------------------- { uint8_t mode; - SetSpeedPeriod(); //e. set the answer transfer rate and its periodicity //r. óñòàíîâèòü ñêîðîñòü ïåðåäà÷è îòâåòà è åãî ïåðèîäè÷íîñòü + SetSpeedPeriod(); //e. set the answer transfer rate and its periodicity //r. ���������� �������� �������� ������ � ��� ������������� UART_SwitchSpeed(trm_rate); - mode = rcv_buf[3] & 0x001f; //e. extract number of the parameters stack in the command //r. âûäåëèòü íîìåð íàáîðà ïàðàìåòðîâ â êîìàíäå + mode = rcv_buf[3] & 0x001f; //e. extract number of the parameters stack in the command //r. �������� ����� ������ ���������� � ������� switch (mode) { - case 1: //e. it is the Rate stack //r. ýòî íàáîð Rate + case 1: //e. it is the Rate stack //r. ��� ����� Rate RgConB = RATE_REPER_OR_REFMEANDR; //e. counter latch every vibro period SwitchRefMeandInt(RATE_REPER_OR_REFMEANDR); //e. enable reference meander interrupt - wrk_period = 12500000; //e. load needed length of working period 1 ñ.//r. çàãðóçèòü òðåáóåìóþ äëèòåëüíîñòü ðàáî÷åãî ïåðèîäà 1 ñ. - num_of_par = 14; //e. 9 parameters or groups of parameters output //r. âûâîäèòü 9 ïàðàìåòðîâ èëè ãðóïï ïàðàìåòðîâ + wrk_period = 12500000; //e. load needed length of working period 1 �.//r. ��������� ��������� ������������ �������� ������� 1 �. + num_of_par = 14; //e. 9 parameters or groups of parameters output //r. �������� 9 ���������� ��� ����� ���������� Valid_Data = 0; // reset all bits of status word - addr_param[0] = &(Output.Str.Cnt_Pls); //e. set the address of the 1st parameter in the 1st group //r. çàäàòü àäðåñ ïåðâîãî ïàðàìåòðà â 1-îé ãðóïïå - addr_param[1] = &(Output.Str.Cnt_Mns); //e. set the address of the 1st parameter in the 2nd group //r. çàäàòü àäðåñ ïåðâîãî ïàðàìåòðà â 2-îé ãðóïïå - addr_param[2] = &(Output.Str.Cnt_Dif); //e. set the address of the 1st parameter in the 3rd group //r. çàäàòü àäðåñ ïåðâîãî ïàðàìåòðà â 3-îé ãðóïïå - addr_param[3] = &(Output.Str.F_ras); //e. set the address of the _F_ras parameter in the 4th group //r. çàäàòü àäðåñ ïàðàìåòðà _F_ras âî 4-îé ãðóïïå - addr_param[4] = &(Output.Str.HF_reg); //e. set the address of the _HF_reg parameter in the 5th group //r. çàäàòü àäðåñ ïàðàìåòðà _HF_reg â 5-åé ãðóïïå - addr_param[5] = &(Output.Str.HF_dif); //e. set the address of the _HF_dif parameter in the 6th group //r. çàäàòü àäðåñ ïàðàìåòðà _HF_dif â 6-îé ãðóïïå - addr_param[6] = &(Output.Str.T_Vibro); //e. parameter _T_Vibro //r. ïàðàìåòð _T_Vibro - addr_param[7] = &(Output.Str.T_VB_pll); //e. parameter _T_VB_pll //r.ïàðàìåòðâ _T_VB_pll - addr_param[8] = &(Output.Str.L_Vibro); //e. parameter _L_Vibro //r. ïàðàìåòð _L_Vibro - addr_param[9] = &(Input.StrIn.HF_out); //e. set the address of the _RI_reg parameter in the 8th group //r. çàäàòü àäðåñ ïàðàìåòðà _RI_reg â 8-îé ãðóïïå - addr_param[10] = &(Output.Str.WP_reg); //e. parameters: _WP_reg, _WP_pll //r. ïàðàìåòðîâ _WP_reg, _WP_pll - addr_param[11] = &(Output.Str.WP_pll); //e. parameters: _WP_reg, _WP_pll //r. ïàðàìåòðîâ _WP_reg, _WP_pll - addr_param[12] = &(Output.Str.Tmp_Out); //e. set the address of the temperature sensors array //r. çàäàòü àäðåñ ìàññèâà äàò÷èêîâ òåìïåðàòóðû - addr_param[13] = &(Output.Str.WP_scope1); //e. reserved //r. çàðåçåðâèðîâàíî äëÿ äàëüíåéøèõ ïðèìåíåíèé + addr_param[0] = &(Output.Str.Cnt_Pls); //e. set the address of the 1st parameter in the 1st group //r. ������ ����� ������� ��������� � 1-�� ������ + addr_param[1] = &(Output.Str.Cnt_Mns); //e. set the address of the 1st parameter in the 2nd group //r. ������ ����� ������� ��������� � 2-�� ������ + addr_param[2] = &(Output.Str.Cnt_Dif); //e. set the address of the 1st parameter in the 3rd group //r. ������ ����� ������� ��������� � 3-�� ������ + addr_param[3] = &(Output.Str.F_ras); //e. set the address of the _F_ras parameter in the 4th group //r. ������ ����� ��������� _F_ras �� 4-�� ������ + addr_param[4] = &(Output.Str.HF_reg); //e. set the address of the _HF_reg parameter in the 5th group //r. ������ ����� ��������� _HF_reg � 5-�� ������ + addr_param[5] = &(Output.Str.HF_dif); //e. set the address of the _HF_dif parameter in the 6th group //r. ������ ����� ��������� _HF_dif � 6-�� ������ + addr_param[6] = &(Output.Str.T_Vibro); //e. parameter _T_Vibro //r. �������� _T_Vibro + addr_param[7] = &(Output.Str.T_VB_pll); //e. parameter _T_VB_pll //r.��������� _T_VB_pll + addr_param[8] = &(Output.Str.L_Vibro); //e. parameter _L_Vibro //r. �������� _L_Vibro + addr_param[9] = &(Input.StrIn.HF_out); //e. set the address of the _RI_reg parameter in the 8th group //r. ������ ����� ��������� _RI_reg � 8-�� ������ + addr_param[10] = &(Output.Str.WP_reg); //e. parameters: _WP_reg, _WP_pll //r. ���������� _WP_reg, _WP_pll + addr_param[11] = &(Output.Str.WP_pll); //e. parameters: _WP_reg, _WP_pll //r. ���������� _WP_reg, _WP_pll + addr_param[12] = &(Output.Str.Tmp_Out); //e. set the address of the temperature sensors array //r. ������ ����� ������� �������� ����������� + addr_param[13] = &(Output.Str.WP_scope1); //e. reserved //r. ��������������� ��� ���������� ���������� - size_param[0] = 2; //e. groups 1-6, 8-10 consists of one parameter ... //r. ãðóïïû 1-6, 8-10 ñîäåðæàò ïî îäíîìó ïàðàìåòðó - size_param[1] = 2; //e. and have 2 bytes length each //r. è èìåþò äëèíó 2 áàéòà êàæäàÿ + size_param[0] = 2; //e. groups 1-6, 8-10 consists of one parameter ... //r. ������ 1-6, 8-10 �������� �� ������ ��������� + size_param[1] = 2; //e. and have 2 bytes length each //r. � ����� ����� 2 ����� ������ size_param[2] = 2; size_param[3] = 2; size_param[4] = 2; @@ -453,76 +453,76 @@ size_param[10] = 2; size_param[11] = 2; - size_param[13] = 4; //e. the 11th group parameters has length of 4 bytes //r. 11-z ãðóïïà ïàðàìåòðîâ èìååò äëèíó 4 áàéòà + size_param[13] = 4; //e. the 11th group parameters has length of 4 bytes //r. 11-z ������ ���������� ����� ����� 4 ����� - size_param[12] = 12; //e. format o the GLD array of temperatures - 12 bytes //r. ôîðìàò ìàññèâà òåìïåðàòóð ÃËÄ - 12 áàéò + size_param[12] = 12; //e. format o the GLD array of temperatures - 12 bytes //r. ������ ������� ���������� ��� - 12 ���� - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� break; - case 2: //e. it is the Rate2 stack //r. ýòî íàáîð Rate2 + case 2: //e. it is the Rate2 stack //r. ��� ����� Rate2 RgConB = RATE_REPER_OR_REFMEANDR; SwitchRefMeandInt(RATE_REPER_OR_REFMEANDR); //e. enable interrupt from ref. meander - wrk_period = 0; //e. frequency of output = fvibro //r. ÷àñòîòà âûâîäà ðàâíà ÷àñòîòå ÂÏ + wrk_period = 0; //e. frequency of output = fvibro //r. ������� ������ ����� ������� �� - num_of_par = 2; //e. 2 parameters output //r. âûâîäèòü 2 ïàðàìåòðà + num_of_par = 2; //e. 2 parameters output //r. �������� 2 ��������� - addr_param[0] = &(Output.Str.Cnt_Pls); //e. set the first parameter address //r. çàäàòü àäðåñ ïåðâîãî ïàðàìåòðà - addr_param[1] = &(Output.Str.Cnt_Mns); //e. and the 2nd //r. è âòîðîãî - size_param[0] = 2; //e. parameters has 2 bytes length //r. ïàðàìåòðû èìååò äëèíó 2 áàéòà + addr_param[0] = &(Output.Str.Cnt_Pls); //e. set the first parameter address //r. ������ ����� ������� ��������� + addr_param[1] = &(Output.Str.Cnt_Mns); //e. and the 2nd //r. � ������� + size_param[0] = 2; //e. parameters has 2 bytes length //r. ��������� ����� ����� 2 ����� size_param[1] = 2; - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� break; - case 3: //e. it is the Rate3 stack //r. ýòî íàáîð Rate3 + case 3: //e. it is the Rate3 stack //r. ��� ����� Rate3 - wrk_period = 2500; //e. frequency of output = 10000 Hz //r. n=1, ÷àñòîòà âûâîäà = 10000 Hz - num_of_par = 2; //e. 2 parameters output //r. âûâîäèòü 2 ïàðàìåòðà + wrk_period = 2500; //e. frequency of output = 10000 Hz //r. n=1, ������� ������ = 10000 Hz + num_of_par = 2; //e. 2 parameters output //r. �������� 2 ��������� - addr_param[0] = &(Output.Str.WP_scope1); //e. set the addresses of output parameters //r. çàäàòü àäðåñà âûâîäèìûõ ïàðàìåòðîâ + addr_param[0] = &(Output.Str.WP_scope1); //e. set the addresses of output parameters //r. ������ ������ ��������� ���������� addr_param[1] = &(Output.Str.WP_scope2); - size_param[0] = 2; //e. all parameters has 2 bytes length //r. âñå ïàðàìåòðû èìåþò äëèíó 2 áàéòà + size_param[0] = 2; //e. all parameters has 2 bytes length //r. ��� ��������� ����� ����� 2 ����� size_param[1] = 2; - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� break; - case 4: //e. it is the Rate4 stack //r. ýòî íàáîð Rate4 - wrk_period = 20000; //e. correspond to output frequency 1.25 kHz //r. ñîîòâåñòâóåò ÷àñòîòå âûâîäà 1.25 kHz - num_of_par = 4; //e. 4 parameters output //r. âûâîäèòü 4 ïàðàìåòðà + case 4: //e. it is the Rate4 stack //r. ��� ����� Rate4 + wrk_period = 20000; //e. correspond to output frequency 1.25 kHz //r. ������������ ������� ������ 1.25 kHz + num_of_par = 4; //e. 4 parameters output //r. �������� 4 ��������� - //e. set the addresses of output parameters //r. çàäàòü àäðåñà âûâîäèìûõ ïàðàìåòðîâ + //e. set the addresses of output parameters //r. ������ ������ ��������� ���������� // --- raw data array of numbers --- // addr_param[0] = &Dif_Curr_Array; // --- filtered array of numbers --- // addr_param[1] = &Dif_Filt_Array; // --------------------------------- - addr_param[2] = &(Output.Str.HF_reg); //e. HFO regulator //r. íàïðÿæåíèå ÃÂ× - addr_param[3] = &(Output.Str.WP_reg); //e. CPLC heater regulator //r. íàïðÿæåíèå íàãðåâàòåëÿ + addr_param[2] = &(Output.Str.HF_reg); //e. HFO regulator //r. ���������� ��� + addr_param[3] = &(Output.Str.WP_reg); //e. CPLC heater regulator //r. ���������� ����������� size_param[0] = 16; size_param[1] = 32; size_param[2] = 2; size_param[3] = 2; - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� break; case 7: - wrk_period = 20000; //e. correspond to output frequency 1250 Hz //r. ñîîòâåñòâóåò ÷àñòîòå âûâîäà 1.25 kHz - num_of_par = 5; //e. 4 parameters output //r. âûâîäèòü 5 ïàðàìåòðà + wrk_period = 20000; //e. correspond to output frequency 1250 Hz //r. ������������ ������� ������ 1.25 kHz + num_of_par = 5; //e. 4 parameters output //r. �������� 5 ��������� - //e. set the addresses of output parameters //r. çàäàòü àäðåñà âûâîäèìûõ ïàðàìåòðîâ + //e. set the addresses of output parameters //r. ������ ������ ��������� ���������� // --- raw data array of PLC phase --- addr_param[0] = &(Output.Str.WP_Phase_Det_Array); // --- filtered array of reference sin--- addr_param[1] = &(Output.Str.WP_sin_Array); // --------------------------------- - addr_param[2] = &(Output.Str.WP_reg); //e. CPLC heater regulator //r. íàïðÿæåíèå íàãðåâàòåëÿ - addr_param[3] = &(Output.Str.WP_pll); //e. CPLC phase //r. ôàçà - addr_param[4] = &(Output.Str.HF_reg); //e. set the address of the _HF_reg parameter in the 5th group //r. çàäàòü àäðåñ ïàðàìåòðà _HF_reg â 5-åé ãðóïïå + addr_param[2] = &(Output.Str.WP_reg); //e. CPLC heater regulator //r. ���������� ����������� + addr_param[3] = &(Output.Str.WP_pll); //e. CPLC phase //r. ���� + addr_param[4] = &(Output.Str.HF_reg); //e. set the address of the _HF_reg parameter in the 5th group //r. ������ ����� ��������� _HF_reg � 5-�� ������ size_param[0] = 16; size_param[1] = 16; size_param[2] = 2; size_param[3] = 2; size_param[4] = 2; - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� break; } SetIntLatch(wrk_period); @@ -533,116 +533,116 @@ while(1); } // will not achieve -void M_Param_R(void) //e. ------------ read the parameter of the GLD from the data memory ---------------------- //r.------------ ÷òåíèå ïàðàìåòðà GLD èç ïàìÿòè äàííûõ ---------------------- +void M_Param_R(void) //e. ------------ read the parameter of the GLD from the data memory ---------------------- //r.------------ ������ ��������� GLD �� ������ ������ ---------------------- { - num_of_par = 1; //e. 1 parameter output //r. âûâîäèòü îäèí ïàðàìåòð - addr_param[0] = (void *)(&Device_blk.Str.My_Addres + rcv_buf[3]); //e. address of the needed parameter in the block //r. àäðåñ òðåáóåìîãî ïàðàìåòðà â áëîêå - size_param[0] = 2; //e. size of the buffer - 2 bytes //r. ðàçìåð áóôåðà - 2 áàéòà + num_of_par = 1; //e. 1 parameter output //r. �������� ���� �������� + addr_param[0] = (void *)(&Device_blk.Str.My_Addres + rcv_buf[3]); //e. address of the needed parameter in the block //r. ����� ���������� ��������� � ����� + size_param[0] = 2; //e. size of the buffer - 2 bytes //r. ������ ������ - 2 ����� - trm_ena = 1; //e. allow operation of the transmitter //r. ðàçðåøèòü ðàáîòó ïåðåäàò÷èêà + trm_ena = 1; //e. allow operation of the transmitter //r. ��������� ������ ����������� } // M_Param_R -void M_Param_W(void) //e.------------ write the parameter of the GLD from the data memory ----------------------- //r.------------ çàïèñü ïàðàìåòðà GLD â ïàìÿòü äàííûõ ----------------------- +void M_Param_W(void) //e.------------ write the parameter of the GLD from the data memory ----------------------- //r.------------ ������ ��������� GLD � ������ ������ ----------------------- { int * ptr; - ScopeMode = 0; //e. VB_DELAY_MEANDER allocate a mode of display for a control point of an scope //r. VB_DELAY_MEANDER íàçíà÷èòü ðåæèì îòîáðàæåíèÿ äëÿ êîíòðîëüíîé òî÷êè îñöèëëîãðàôà + ScopeMode = 0; //e. VB_DELAY_MEANDER allocate a mode of display for a control point of an scope //r. VB_DELAY_MEANDER ��������� ����� ����������� ��� ����������� ����� ������������ ptr = (int *)&Device_blk.Str.My_Addres; // pointer to Parameters block ptr += rcv_buf[3]; // calculate offset *ptr = (rcv_buf[4] << 8) | (rcv_buf[5] & 0xFF); // write new parameter value - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_Ask1(); } // M_Param_W -void M_LdPar_F() //e.============ procedure for load the GLD parameters from the flash-memory =========== //r.============ ïðîöåäóðà çàãðóçêè ïàðàìåòðîâ ÃËÄ èç ôëýø-ïàìÿòè =========== +void M_LdPar_F() //e.============ procedure for load the GLD parameters from the flash-memory =========== //r.============ ��������� �������� ���������� ��� �� ����-������ =========== { - LoadFlashParam(FromFLASH); //e. load the GLD parameters from the flash-memory //r. çàãðóçèòü ïàðàìåòðû ÃËÄ èç ôäýø-ïàìÿòè + LoadFlashParam(FromFLASH); //e. load the GLD parameters from the flash-memory //r. ��������� ��������� ��� �� ����-������ blt_in_test = ((uint32_t)FIRMWARE_VER << 8) | (Device_blk.Str.Device_SerialNumber & 0x00FF); // Init_software(); - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_Ask1(); } // M_LdPar_F -void M_LdPar_D(void) //e.============ procedure for set parameters of the GLD by default ============ //r.============ ïðîöåäóðà óñòàíîâêè ïàðàìåòðîâ ÃËÄ ïî óìîë÷àíèþ ============ +void M_LdPar_D(void) //e.============ procedure for set parameters of the GLD by default ============ //r.============ ��������� ��������� ���������� ��� �� ��������� ============ { #if !defined COMMAND_DEBUG - LoadFlashParam(ByDefault); //e. define parameters of the GLD by default //r. îïðåäåëèòü ïàðàìåòðû ÃËÄ ïî óìîë÷àíèþ (default) + LoadFlashParam(ByDefault); //e. define parameters of the GLD by default //r. ���������� ��������� ��� �� ��������� (default) Init_software(); #endif - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_Ask1(); } // M_LdPar_D -void M_Start(void) //e.============ initialization of the GLD switch on ================================= //r.============ èíèöèàëèçàöèÿ çàïóñêà ÃËÄ ================================= +void M_Start(void) //e.============ initialization of the GLD switch on ================================= //r.============ ������������� ������� ��� ================================= { - start_Rq = 1; //e. set the flag of the GLD switch on request //r. óñòàíîâèòü ôëàã çàïðîñà ñòàðòà ÃËÄ - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + start_Rq = 1; //e. set the flag of the GLD switch on request //r. ���������� ���� ������� ������ ��� + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_Ask1(); } // M_Start -void M_Stop(void) //e.============ initialization of the GLD switch off ============================== //r.============ èíèöèàëèçàöèÿ âûêëþ÷åíèÿ ÃËÄ ============================== +void M_Stop(void) //e.============ initialization of the GLD switch off ============================== //r.============ ������������� ���������� ��� ============================== { - stop_Rq = 1; //e. set the flag of the GLD switch off request //r. óñòàíîâèòü ôëàã çàïðîñà âûêëþ÷åíèÿ ÃËÄ - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + stop_Rq = 1; //e. set the flag of the GLD switch off request //r. ���������� ���� ������� ���������� ��� + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_Ask1(); } // M_Stop -void M_Pulse(void) //e.============ generetion of the light-up pulse ========================= //r.============ ãåíåðàöèÿ èìïóëüñà çàïóñêà ëàçåðà ========================= +void M_Pulse(void) //e.============ generetion of the light-up pulse ========================= //r.============ ��������� �������� ������� ������ ========================= { - pulse_Rq = 1; //e. set the flag of the GLD switch on request //r. óñòàíîâèòü ôëàã çàïðîñà ñòàðòà ÃËÄ - trm_cycl = 0; //e. periodic data transmission is not needed //r. ïåðèîäè÷åñêàÿ ïåðåäà÷à îòâåòà íå òðåáóåòñÿ + pulse_Rq = 1; //e. set the flag of the GLD switch on request //r. ���������� ���� ������� ������ ��� + trm_cycl = 0; //e. periodic data transmission is not needed //r. ������������� �������� ������ �� ��������� Mk_Ask1(); } // M_Pulse -void B_Rate(void) //e. === procedure of device operation in a mode of continuous output of raw data //r. === ïðîöåäóðà ðàáîòû ïðèáîðà â ðåæèìå íåïðåðûâíîé âûäà÷è "ñûðûõ" äàííûõ +void B_Rate(void) //e. === procedure of device operation in a mode of continuous output of raw data //r. === ��������� ������ ������� � ������ ����������� ������ "�����" ������ { } // B_Rate -void B_Delta(void) //e. === procedure not used //r. === ïðîöåäóðà íå èñïîëüçóåòñÿ +void B_Delta(void) //e. === procedure not used //r. === ��������� �� ������������ { } // B_Delta -void D_Period_W(void) //e. === set the period of the angle increase output //r. === óñòàíîâêà ïåðèîäà âûäà÷è ïðèðàùåíèÿ óãëà +void D_Period_W(void) //e. === set the period of the angle increase output //r. === ��������� ������� ������ ���������� ���� { } // D_Period_W // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -void exec_CMD(void) //e. === the final decoding and command execution procedure //r. === ïðîöåäóðà îêîí÷àòåëüíîé äåøèôðàöèè è èñïîëíåíèÿ êîìàíäû +void exec_CMD(void) //e. === the final decoding and command execution procedure //r. === ��������� ������������� ���������� � ���������� ������� { uint32_t wcode; - rx_buf_copy = 1; //e. initialization of the flag of copying of receiving buffer //r. ïðåäóñòàíîâ ôëàãà êîïèðîâàíèÿ ïðèåìíîãî áóôåðà + rx_buf_copy = 1; //e. initialization of the flag of copying of receiving buffer //r. ����������� ����� ����������� ��������� ������ wcode = (rcv_buf[2] & 0xFF) << 8; - CMD_Code = wcode | (rcv_buf[3] & 0xFF); //e. save it in the memory for echo-transmission //r. ñîõðàíèòü åãî â ïàìÿòè äëÿ îáðàòíîé ïåðåäà÷è + CMD_Code = wcode | (rcv_buf[3] & 0xFF); //e. save it in the memory for echo-transmission //r. ��������� ��� � ������ ��� �������� �������� - if (wcode == CMD_RATE) //e. is it Rate command? //r. ýòî êîìàíäà Rate? + if (wcode == CMD_RATE) //e. is it Rate command? //r. ��� ������� Rate? { B_Rate(); return; } - else if (wcode == CMD_DEV_MODE) //e. is it the Device_Mode command? //r. ýòî êîìàíäà óñòàíîâêè ðåæèìà ïðèáîðà? + else if (wcode == CMD_DEV_MODE) //e. is it the Device_Mode command? //r. ��� ������� ��������� ������ �������? { CMD_Mode = 3; B_Dev_Mode(); return; } - else if (wcode == CMD_DELTA_BINS) //e. is it the B_DeltaBINS command (command of request for data transfer to the navigation system)? //r. ýòî êîìàíäà çàïðîñà ïåðåäà÷è äàííûõ â íàâèã.ñèñòåìó? + else if (wcode == CMD_DELTA_BINS) //e. is it the B_DeltaBINS command (command of request for data transfer to the navigation system)? //r. ��� ������� ������� �������� ������ � �����.�������? { - RgConB = RATE_VIBRO_1; //e. set in the additional register of device control the mode of work with dither counters and the filter of moving average //r. óñòàíàâëèâàåì â äîïîëíèòåëüíîì ðåãèñòðå óïðàâëåíèÿ ðåæèì ðàáîòû ñ âèáðîñ÷åò÷èêàìè è ôèëüòðîì ñêîëüçÿùåãî ñðåäíåãî + RgConB = RATE_VIBRO_1; //e. set in the additional register of device control the mode of work with dither counters and the filter of moving average //r. ������������� � �������������� �������� ���������� ����� ������ � ��������������� � �������� ����������� �������� SetSpeedPeriod(); UART_SwitchSpeed(trm_rate); CMD_Mode = 4; B_Delta_BINS(); return; } - else if (wcode == CMD_DELTA_PS) //e. is it the B_DeltaPS command (command of request for data transfer to the uPC)? //r. ýòî êîìàíäà çàïðîñà ïåðåäà÷è äàííûõ â MkPC? + else if (wcode == CMD_DELTA_PS) //e. is it the B_DeltaPS command (command of request for data transfer to the uPC)? //r. ��� ������� ������� �������� ������ � MkPC? { - SetSpeedPeriod(); //e. and set the answer transfer rate and its periodicity //r. è óñòàíîâèòü ñêîðîñòü ïåðåäà÷è îòâåòà è åãî ïåðèîäè÷íîñòü (_trm_cycl) + SetSpeedPeriod(); //e. and set the answer transfer rate and its periodicity //r. � ���������� �������� �������� ������ � ��� ������������� (_trm_cycl) UART_SwitchSpeed(trm_rate); if (Device_Mode < 4) //e. work with internal latch Device_Mode = DM_INT_LATCH_DELTA_PS; @@ -654,37 +654,37 @@ } else if (wcode == CMD_DELTA_SF) // is it the B_DeltaSF command? { - SetSpeedPeriod(); //e. and set the answer transfer rate and its periodicity //r. è óñòàíîâèòü ñêîðîñòü ïåðåäà÷è îòâåòà è åãî ïåðèîäè÷íîñòü (_trm_cycl) + SetSpeedPeriod(); //e. and set the answer transfer rate and its periodicity //r. � ���������� �������� �������� ������ � ��� ������������� (_trm_cycl) CMD_Mode = 7; - if ((rcv_buf[3] & 0x0001) != 0) //e.reset of accumulated number is disabled //r. ñáðîñ íàêîïëåííîãî ìåæäó çàùåëêàìè ÷èñëà çàïðåùåí + if ((rcv_buf[3] & 0x0001) != 0) //e.reset of accumulated number is disabled //r. ����� ������������ ����� ��������� ����� �������� Ext_Latch_ResetEnable = 0; else Ext_Latch_ResetEnable = 1; B_Delta_SF(); return; } - else if (wcode == CMD_BIT_MODE) //e. is this the BIT mode command? //r. ýòî êîìàíäà òåñòèðîâàíèÿ? + else if (wcode == CMD_BIT_MODE) //e. is this the BIT mode command? //r. ��� ������� ������������? { - CMD_Mode = 6; //e. set the value of the Delta mode//r. óñòàíîâèòü çíà÷åíèå ðåæèìà Delta + CMD_Mode = 6; //e. set the value of the Delta mode//r. ���������� �������� ������ Delta B_BIT_Mode(); return; } - else if (wcode == CMD_DELTA) //e. is this the B_Delta command? //r. ýòî êîìàíäà B_Delta? + else if (wcode == CMD_DELTA) //e. is this the B_Delta command? //r. ��� ������� B_Delta? { - CMD_Mode = 2; //e. set the value of the Delta mode//r. óñòàíîâèòü çíà÷åíèå ðåæèìà Delta - B_Delta(); //e. output calculated value of angle increase //r. âûâîäèòü âû÷èñëåííîå çíà÷åíèå ïðèðàùåíèÿ óãëà + CMD_Mode = 2; //e. set the value of the Delta mode//r. ���������� �������� ������ Delta + B_Delta(); //e. output calculated value of angle increase //r. �������� ����������� �������� ���������� ���� return; } - else if (CMD_Code == CMD_MAINT) //e. is this the Maintenance mode command? //r. ýòî êîìàíäà Maintenance mode? + else if (CMD_Code == CMD_MAINT) //e. is this the Maintenance mode command? //r. ��� ������� Maintenance mode? { if (!RgConB) { RgConB = RATE_VIBRO_1; SwitchRefMeandInt(RATE_VIBRO_1); //e. disable interrupt from referense meander } - CMD_Mode = 5; //e. yes, switch on present mode //r. äà, âêëþ÷èòü äàííûé ðåæèì - M_Status(); //e. output the status stack of registers //r. âûâåñòè ñòàòóñíûé íàáîð ðåãèñòðîâ - if (Device_Mode != DM_INT_10KHZ_LATCH) //e. mode of internal latch 10 kHz //r. ðåæèì âíóòðåííåé çàùåëêè 10 êÃö + CMD_Mode = 5; //e. yes, switch on present mode //r. ��, �������� ������ ����� + M_Status(); //e. output the status stack of registers //r. ������� ��������� ����� ��������� + if (Device_Mode != DM_INT_10KHZ_LATCH) //e. mode of internal latch 10 kHz //r. ����� ���������� ������� 10 ��� { Device_Mode = DM_INT_10KHZ_LATCH; trm_ena = 0; @@ -693,7 +693,7 @@ UART_SwitchSpeed(trm_rate); return; } - else if (wcode == SUBCMD_M_RESET) //e. is this subcommand for modification of the device control register? //r. ýòî ïîäêîìàíäà ìîäèôèêàöèè ðåãèñòðà óïðàâëåíèÿ ó-âà? + else if (wcode == SUBCMD_M_RESET) //e. is this subcommand for modification of the device control register? //r. ��� ���������� ����������� �������� ���������� �-��? { // Mk_AskDev(); M_Reset(); @@ -701,11 +701,11 @@ } else // subcommand analyse { - if (CMD_Mode == 2) //e. is this the 2(Delta) mode? //r. ýòî ðåæèì 2? (Delta) + if (CMD_Mode == 2) //e. is this the 2(Delta) mode? //r. ��� ����� 2? (Delta) { - if (CMD_Code == CMD_D_PERIOD_W) //e. the Delta mode, check the subcommand ... //r. ðåæèì DElta, ïðîâåðèòü ïîäêîìàíäó çàãðóçêè ïåðèîäà + if (CMD_Code == CMD_D_PERIOD_W) //e. the Delta mode, check the subcommand ... //r. ����� DElta, ��������� ���������� �������� ������� { - D_Period_W(); //e. otherwise - set the data transfer period //r. èíà÷å óñòàíîâèòèü ïåðèîä âûäà÷è äàííûõ + D_Period_W(); //e. otherwise - set the data transfer period //r. ����� ����������� ������ ������ ������ return; } else @@ -714,122 +714,122 @@ return; } } - else if (CMD_Mode == 5) //e. check the 5 mode (Maintenance) //r. ïðîâåðêà ðåæèìà 5 (Maintenance) + else if (CMD_Mode == 5) //e. check the 5 mode (Maintenance) //r. �������� ������ 5 (Maintenance) { - if (CMD_Code == SUBCMD_M_CLEAR) //e. is this subcommand of cleaning of the error register? //r. ýòî ïîäêîìàíäà î÷èñòêè ðåãèñòðà îøèáîê ëèíèè? + if (CMD_Code == SUBCMD_M_CLEAR) //e. is this subcommand of cleaning of the error register? //r. ��� ���������� ������� �������� ������ �����? { - M_Clear(); //e. yes, cleaning the error register //r. äà, î÷èñòêà ðåãèñòðà îøèáîê - M_Status(); //e. preparing for trabsfer of the device status //r. ïîäãîòîâêà ïåðåäà÷è ñòàòóñà óñòðîéñòâà + M_Clear(); //e. yes, cleaning the error register //r. ��, ������� �������� ������ + M_Status(); //e. preparing for trabsfer of the device status //r. ���������� �������� ������� ���������� UART_SwitchSpeed(trm_rate); return; } - else if (CMD_Code == SUBCMD_M_MIRR) //e. is this subcommand of return of previous command? //r. ýòî ïîäêîìàíäà âîçâðàòà ïðåäûäóùåé êîìàíäû? + else if (CMD_Code == SUBCMD_M_MIRR) //e. is this subcommand of return of previous command? //r. ��� ���������� �������� ���������� �������? { - rx_buf_copy = 0; //e. yes, forbid copying of command on saving previous //r. äà, çàïðåòèòü êîïèðîâàíèå êîìàíäû äëÿ ñîõðàíåíèÿ ïðåäûäóùåé - M_Mirror(); //e. prepare transfer of the receiving buffer copy //r. ïîäãîòîâèòü ïåðåäà÷ó êîïèè ïðèåìíîãî áóôåðà + rx_buf_copy = 0; //e. yes, forbid copying of command on saving previous //r. ��, ��������� ����������� ������� ��� ���������� ���������� + M_Mirror(); //e. prepare transfer of the receiving buffer copy //r. ����������� �������� ����� ��������� ������ return; } - /* else if (wcode == SUBCMD_M_TMP_W) //e. is this subcommand for writing instructions to the AD7714? //r. ýòî ïîäêîìàíäà çàïèñè èíñòðóêöèé â AD7714? + /* else if (wcode == SUBCMD_M_TMP_W) //e. is this subcommand for writing instructions to the AD7714? //r. ��� ���������� ������ ���������� � AD7714? { - // M_Tmp_W(); //e. yes, procedure call of write of the command //r. äà, âûçîâ ïðîöåäóðû çàïèñè êîìàíäû + // M_Tmp_W(); //e. yes, procedure call of write of the command //r. ��, ����� ��������� ������ ������� return; } */ - else if (wcode == SUBCMD_M_TMP_R) //e. is this subcommand for data read from the AD7714? //r. ýòî ïîäêîìàíäà ÷òåíèÿ äàííûõ èç AD7714? + else if (wcode == SUBCMD_M_TMP_R) //e. is this subcommand for data read from the AD7714? //r. ��� ���������� ������ ������ �� AD7714? { - M_Tmp_R(); //r. yes, call the procedure for data read //e. äà, âûçîâ ïðîöåäóðû ÷òåíèÿ äàííûõ + M_Tmp_R(); //r. yes, call the procedure for data read //e. ��, ����� ��������� ������ ������ return; } - /* else if (wcode == SUBCMD_M_E5R_W) //e. is this subcommand for write to the mode register? //r. ýòî ïîäêîìàíäà çàïèñè â ðåãèñòð ðåæèìà? + /* else if (wcode == SUBCMD_M_E5R_W) //e. is this subcommand for write to the mode register? //r. ��� ���������� ������ � ������� ������? { - M_e5r_W(); //e. yes, write data to the mode register of the Elio5 card //r. äà, çàïèñàòü äàííûå â ðåãèñòð ðåæèìà ïëàòû Elio5 + M_e5r_W(); //e. yes, write data to the mode register of the Elio5 card //r. ��, �������� ������ � ������� ������ ����� Elio5 return; } - else if (wcode == SUBCMD_M_E5RA_W) //e. is this subcommand for write to the mode register? //r. ýòî ïîäêîìàíäà çàïèñè â ðåãèñòð ðåæèìà? + else if (wcode == SUBCMD_M_E5RA_W) //e. is this subcommand for write to the mode register? //r. ��� ���������� ������ � ������� ������? { - M_e5rA_W(); //e. yes, write data to the mode register of the Elio5 card //r. äà, çàïèñàòü äàííûå â ðåãèñòð ðåæèìà ïëàòû Elio5 + M_e5rA_W(); //e. yes, write data to the mode register of the Elio5 card //r. ��, �������� ������ � ������� ������ ����� Elio5 return; } */ - else if (wcode == SUBCMD_M_ADC_R) //e. is t the subcommand for data read from ADCs ADS1250 and ADS8321 ? //r. ýòî ïîäêîìàíäà ÷òåíèÿ äàííûõ èç ÀÖÏ ADS1250 è ADS8321? + else if (wcode == SUBCMD_M_ADC_R) //e. is t the subcommand for data read from ADCs ADS1250 and ADS8321 ? //r. ��� ���������� ������ ������ �� ��� ADS1250 � ADS8321? { - M_ADC_R(); //e. read of ADC channels //r. ÷òåíèå êàíàëîâ ÀÖÏ + M_ADC_R(); //e. read of ADC channels //r. ������ ������� ��� return; } - else if (wcode == SUBCMD_M_CNT_R) //e. is this subcommand of data read from pulse counters? //r. ýòî ïîäêîìàíäà ÷òåíèÿ äàííûõ èç ñ÷åò÷èêîâ èìïóëüñîâ? + else if (wcode == SUBCMD_M_CNT_R) //e. is this subcommand of data read from pulse counters? //r. ��� ���������� ������ ������ �� ��������� ���������? { - M_Cnt_R(); //e. read of counters //r. ÷òåíèå ñ÷åò÷èêîâ + M_Cnt_R(); //e. read of counters //r. ������ ��������� return; } - else if (wcode == SUBCMD_M_FLG_R) //e. is it the command of data read about input flags? //r. ýòî ïîäêîìàíäà ÷òåíèÿ äàííûõ î âõîäíûõ ôëàãàõ? + else if (wcode == SUBCMD_M_FLG_R) //e. is it the command of data read about input flags? //r. ��� ���������� ������ ������ � ������� ������? { - M_Flg_R(); //e. read the input flags //r. ÷èòàòü âõîäíûå ôëàãè + M_Flg_R(); //e. read the input flags //r. ������ ������� ����� return; } - else if (wcode == SUBCMD_M_VIB_W) //e. is this subcommand for load the dither drive period? //r. ýòî ïîäêîìàíäà çàãðóçêè ïåðèîäà âèáðîïðèâîäà? + else if (wcode == SUBCMD_M_VIB_W) //e. is this subcommand for load the dither drive period? //r. ��� ���������� �������� ������� ������������? { - M_Vib_W(); //e. set the new value of the period //r. óñòàíîâèòü íîâîå çíà÷åíèå ïåðèîäà + M_Vib_W(); //e. set the new value of the period //r. ���������� ����� �������� ������� return; } - else if (wcode == SUBCMD_M_GPH_W) //e. is this subcommand for set the gain factor of photodetector channels? //r. ýòî ïîäêîìàíäà óñòàíîâêè óñèëåíèÿ êàíàëîâ ôîòîïðèåìíèêà ? + else if (wcode == SUBCMD_M_GPH_W) //e. is this subcommand for set the gain factor of photodetector channels? //r. ��� ���������� ��������� �������� ������� ������������� ? { - M_Gph_W(); //e. set the new values of gain factor //r. óñòàíîâèòü íîâûå çíà÷åíèÿ óñèëåíèÿ + M_Gph_W(); //e. set the new values of gain factor //r. ���������� ����� �������� �������� return; } - else if (wcode == SUBCMD_M_STIMUL) //e. is this subcommand for set the values of the DACs and flags? //r. ýòî ïîäêîìàíäà óñòàíîâêè çíà÷åíèÿ ÖÀÏîâ è ôäàãîâ ? + else if (wcode == SUBCMD_M_STIMUL) //e. is this subcommand for set the values of the DACs and flags? //r. ��� ���������� ��������� �������� ����� � ������ ? { - M_Stimul(); //e. set the new values //r. óñòàíîâèòü íîâûå çíà÷åíèÿ + M_Stimul(); //e. set the new values //r. ���������� ����� �������� return; } - else if (wcode == SUBCMD_M_RATE) //e. is this subcommand for set the M_Rate output stack //r. ýòî ïîäêîìàíäà óñòàíîâêè âûäà÷è íàáîðà M_Rate ? + else if (wcode == SUBCMD_M_RATE) //e. is this subcommand for set the M_Rate output stack //r. ��� ���������� ��������� ������ ������ M_Rate ? { - M_Rate(); //e. switch on the M_Rate data transfer //r. âêëþ÷èòü ïåðåäà÷ó äàííûõ M_Rate + M_Rate(); //e. switch on the M_Rate data transfer //r. �������� �������� ������ M_Rate return; } - else if (wcode == SUBCMD_M_PARAM_W) //e. is this subcommand for write the new value of the GLD parameter ... //r. ýòî ïîäêîìàíäà çàïèñè íîâîãî çíà÷åíèÿ ïàðàìåòðà GLD + else if (wcode == SUBCMD_M_PARAM_W) //e. is this subcommand for write the new value of the GLD parameter ... //r. ��� ���������� ������ ������ �������� ��������� GLD { - M_Param_W(); //e. write the new value of the parameter //r. çàïèñàòü íîâîå çíà÷åíèå ïàðàìåòðà + M_Param_W(); //e. write the new value of the parameter //r. �������� ����� �������� ��������� return; } - else if (wcode == SUBCMD_M_PARAM_R) //e. is this subcommand for read the value of the GLD parameter? //r. ýòî ïîäêîìàíäà ÷òåíèÿ çíà÷åíèÿ ïàðàìåòðà GLD? + else if (wcode == SUBCMD_M_PARAM_R) //e. is this subcommand for read the value of the GLD parameter? //r. ��� ���������� ������ �������� ��������� GLD? { - M_Param_R(); //e. read the value from the data memory //r. ñ÷èòàòü çíà÷åíèå ïàðàìåòðà èç ïàìÿòè äàíûõ + M_Param_R(); //e. read the value from the data memory //r. ������� �������� ��������� �� ������ ����� return; } - else if (CMD_Code == SUBCMD_M_LDPAR_F) //e. is this subcommand for load GLD parameters ... //r. ýòî ïîäêîìàíäà çàãðóçêè ïàðàìåòðîâ GLD + else if (CMD_Code == SUBCMD_M_LDPAR_F) //e. is this subcommand for load GLD parameters ... //r. ��� ���������� �������� ���������� GLD { - M_LdPar_F(); //e. start the loading of parameters //r. çàïóñòèòü çàãðóçêó ïàðàìåòðîâ + M_LdPar_F(); //e. start the loading of parameters //r. ��������� �������� ���������� return; } - else if (CMD_Code == SUBCMD_M_LDPAR_D) //e. is this subcommand for direct setting of the GLD parameters ... //r. ýòî ïîäêîìàíäà ïðÿìîãî íàçíà÷åíèÿ ïàðàìåòðîâ GLD + else if (CMD_Code == SUBCMD_M_LDPAR_D) //e. is this subcommand for direct setting of the GLD parameters ... //r. ��� ���������� ������� ���������� ���������� GLD { - M_LdPar_D(); //e. read the value of the parameter from the data memory //r. ñ÷èòàòü çíà÷åíèå ïàðàìåòðà èç ïàìÿòè äàíûõ + M_LdPar_D(); //e. read the value of the parameter from the data memory //r. ������� �������� ��������� �� ������ ����� return; } - else if (CMD_Code == SUBCMD_M_START) //e. is this subcommand for GLD starting? //r. ýòî ïîäêîìàíäà çàïóñêà GLD? + else if (CMD_Code == SUBCMD_M_START) //e. is this subcommand for GLD starting? //r. ��� ���������� ������� GLD? { - M_Start(); //e. call the procedure of start //r. çàïóñòèòü ïðîöåäóðó ñòàðòà + M_Start(); //e. call the procedure of start //r. ��������� ��������� ������ return; } - else if (CMD_Code == SUBCMD_M_PULSE) //e. is this subcommand for GLD starting? //r. ýòî ïîäêîìàíäà çàïóñêà GLD? + else if (CMD_Code == SUBCMD_M_PULSE) //e. is this subcommand for GLD starting? //r. ��� ���������� ������� GLD? { - M_Pulse(); //e. call light-up function //r. âûäàòü èìïóëüñ ïîäæèãà + M_Pulse(); //e. call light-up function //r. ������ ������� ������� return; } - else if (CMD_Code == SUBCMD_M_STOP) //e. is this subcommand for GLD switch off? //r. ýòî ïîäêîìàíäà âûêëþ÷åíèÿ GLD? + else if (CMD_Code == SUBCMD_M_STOP) //e. is this subcommand for GLD switch off? //r. ��� ���������� ���������� GLD? { - M_Stop(); //e. otherwise- switch off all regulators and stop device //r. âûêëþ÷èòü âñå êîíòóðû è îñòàíîâèòü ïðèáîð + M_Stop(); //e. otherwise- switch off all regulators and stop device //r. ��������� ��� ������� � ���������� ������ return; } - else if (wcode == SUBCMD_M_CTL_R) //e. is this subcommand for read the device control register? //r. ýòî ïîäêîìàíäà ÷òåíèÿ ðåãèñòðà óïðàâëåíèÿ ó-âà? + else if (wcode == SUBCMD_M_CTL_R) //e. is this subcommand for read the device control register? //r. ��� ���������� ������ �������� ���������� �-��? { M_Ctl_R(); return; } - else if (wcode == SUBCMD_M_CTL_M) //e. is this subcommand for modification of the device control register? //r. ýòî ïîäêîìàíäà ìîäèôèêàöèè ðåãèñòðà óïðàâëåíèÿ ó-âà? + else if (wcode == SUBCMD_M_CTL_M) //e. is this subcommand for modification of the device control register? //r. ��� ���������� ����������� �������� ���������� �-��? { M_Ctl_M(); return; } -/* else if (wcode == SUBCMD_M_RESET) //e. is this subcommand for modification of the device control register? //r. ýòî ïîäêîìàíäà ìîäèôèêàöèè ðåãèñòðà óïðàâëåíèÿ ó-âà? +/* else if (wcode == SUBCMD_M_RESET) //e. is this subcommand for modification of the device control register? //r. ��� ���������� ����������� �������� ���������� �-��? { M_Reset(); return; @@ -847,15 +847,15 @@ { int size; - if (!rcv_Rdy) //e. is data in receive buffer? //r. â ïðèåìíîì áóôåðå åñòü èíôîðìàöèÿ? + if (!rcv_Rdy) //e. is data in receive buffer? //r. � �������� ������ ���� ����������? { - return; //e. if no, stop processing //r. åñëè íåò, çàêîí÷èòü îáðàáîòêó + return; //e. if no, stop processing //r. ���� ���, ��������� ��������� } - if (!line_sts) //e. Whether there were errors of receiving of start-bit? //r. áûëè ëè îøèáêè ïðèåìà ñòàðò-áèòà ? + if (!line_sts) //e. Whether there were errors of receiving of start-bit? //r. ���� �� ������ ������ �����-���� ? { - //e. there were not errors of receiving of bytes, check the device address //r. îøèáîê ïðèåìà áàéòîâ íå áûëî, ïðîâåðèòü àäðåñ îáðàùåíèÿ - //Is_Brodcast_Req = 0; //e. reset the flag of broadcasting request //r. ñáðîñèòü ôëàã øèðîêîâåùàòåëüíîãî çàïðîñà + //e. there were not errors of receiving of bytes, check the device address //r. ������ ������ ������ �� ����, ��������� ����� ��������� + //Is_Brodcast_Req = 0; //e. reset the flag of broadcasting request //r. �������� ���� ������������������ ������� if (rcv_buf[1] != Device_blk.Str.My_Addres) { if (rcv_buf[1] != BROADCAST_ADDRESS) @@ -865,26 +865,26 @@ } if (rcv_buf[0] == COMMAND_PREFIX) - { //e. there is new command in the receiver buffer, stop the transfer //r. â áóôåðå ïðèåìíèêà åñòü íîâàÿ êîìàíäà, ïðåêðàòèòü ïåðåäà÷ó - trm_ena = 0; //e. reset the flag of transmission allowing //r. ñáðîñèòü ôëàã ðàçðåøåíèÿ ïåðåäà÷è + { //e. there is new command in the receiver buffer, stop the transfer //r. � ������ ��������� ���� ����� �������, ���������� �������� + trm_ena = 0; //e. reset the flag of transmission allowing //r. �������� ���� ���������� �������� //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - exec_CMD(); // øåé êîìàíäû + exec_CMD(); // ��� ������� ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //e. check up presence of errors in operation of this procedure //r. ïðîâåðèòü, íàëè÷èå îøèáîê â ðàáîòå äàííîé ïîöåäóðû - //e. did is the "unknown code of a command" or "parameters were set incorrectly" error? //r. áûëà îøèáêà "íåèçâåñòíûé êîä êîìàíäû" èëè "íåâåðíî çàäàííûå ïàðàìåòðû"? + //e. check up presence of errors in operation of this procedure //r. ���������, ������� ������ � ������ ������ �������� + //e. did is the "unknown code of a command" or "parameters were set incorrectly" error? //r. ���� ������ "����������� ��� �������" ��� "������� �������� ���������"? if ( ((line_sts & CODE_ERR) == CODE_ERR) || ((line_sts & PARAM_ERR) == PARAM_ERR) ) { - line_err = line_sts; //e. set error bits in the error register of the line //r. óñòàíîâèòü áèòû îøèáîê â ðåãèñòðå îøèáîê ëèíèè + line_err = line_sts; //e. set error bits in the error register of the line //r. ���������� ���� ������ � �������� ������ ����� } } else { - line_err = line_sts | NO_CMD_ERR; // äîáàâëåíèå îøèáêè â ðåãèñòð îøèáîê + line_err = line_sts | NO_CMD_ERR; // ���������� ������ � ������� ������ } } @@ -893,24 +893,24 @@ line_err = line_sts; } end: - if (rx_buf_copy) //e. is copying of present received packet needed? //r. òðåáóåòñÿ êîïèðîâàíèå äàííîãî ïðèíÿòîãî ïàêåòà? + if (rx_buf_copy) //e. is copying of present received packet needed? //r. ��������� ����������� ������� ��������� ������? { size = rcv_num_byt; - rcv_byt_copy = rcv_num_byt; //e. save the size of copy //r. çàïîìíèòü ðàçìåð êîïèè - if (rcv_num_byt > sizeof(rcv_buf)) //e. compare the size of receiving buffer with amount of received bytes //r. êîïèðîâàíèå òðåáóåòñÿ, ñðàâíèòü ðàçìåð ïðèåìíîãî áóôåðà ñ ÷èñëîì ïðèíÿòûõ áàéò + rcv_byt_copy = rcv_num_byt; //e. save the size of copy //r. ��������� ������ ����� + if (rcv_num_byt > sizeof(rcv_buf)) //e. compare the size of receiving buffer with amount of received bytes //r. ����������� ���������, �������� ������ ��������� ������ � ������ �������� ���� { size = sizeof(rcv_buf); } - memcpy(rcv_copy, rcv_buf, size); //e. copy of received amount of bytes, but no more than buffer size //r. êîïèðîâàòü ïðèíÿòîå ÷èñëî áàéò, íî íå áîëåå ðàçìåðà áóôåðà + memcpy(rcv_copy, rcv_buf, size); //e. copy of received amount of bytes, but no more than buffer size //r. ���������� �������� ����� ����, �� �� ����� ������� ������ } - rx_buf_copy = 0; //e. reset the flag of necessity of copying of receiving buffer //r. ñáðîñèòü ôëàã íåîáõîäèìîñòè êîïèðîâàíèÿ ïðèåìíîãî áóôåðà + rx_buf_copy = 0; //e. reset the flag of necessity of copying of receiving buffer //r. �������� ���� ������������� ����������� ��������� ������ do rcv_buf[--rcv_num_byt] = 0; while(rcv_num_byt); rcv_num_byt_old = rcv_num_byt; - line_sts = 0; //e. reset the line status register //r. ñáðîñèòü ðåãèñòð ñòàòóñà ëèíèè - rcv_Rdy = 0; //e. allow further data reception //r. ðàçðåøèòü äàëüíåéøèé ïðèåì äàííûõ + line_sts = 0; //e. reset the line status register //r. �������� ������� ������� ����� + rcv_Rdy = 0; //e. allow further data reception //r. ��������� ���������� ����� ������ } // decode_CMD
--- a/console.c Sat Jan 30 13:00:39 2016 +0000 +++ b/console.c Sat Jan 30 13:53:19 2016 +0000 @@ -1,6 +1,7 @@ -#include "console.h" -#include "lpc17xx.h" -#include "CyclesSync.h" +#include "Global.h" + + + #define FOSC 12000000 #define FCCLK (FOSC * 8) @@ -30,7 +31,7 @@ void UART0_Init_m (void)///�������������� �������� ����� - +{ uint16_t usFdiv; /* UART0 */ LPC_PINCON->PINSEL0 |= (1 << 4); /* Pin P0.2 used as TXD0 (Com0) */
--- a/core_cmInstr.h Sat Jan 30 13:00:39 2016 +0000 +++ b/core_cmInstr.h Sat Jan 30 13:53:19 2016 +0000 @@ -8,9 +8,9 @@ * Copyright (C) 2009-2010 ARM Limited. All rights reserved. * * @par - * ARM Limited (ARM) is supplying this software for use with Cortex-M - * processor based microcontrollers. This file can be freely distributed - * within development tools that are supporting such ARM based processors. + * ARM Limited (ARM) is supplying this software for use with Cortex-M + * processor based microcontrollers. This file can be freely distributed + * within development tools that are supporting such ARM based processors. * * @par * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED @@ -66,8 +66,8 @@ /** \brief Instruction Synchronization Barrier - Instruction Synchronization Barrier flushes the pipeline in the processor, - so that all instructions following the ISB are fetched from cache or + Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or memory, after the instruction has been completed. */ #define __ISB() __isb(0xF) @@ -75,7 +75,7 @@ /** \brief Data Synchronization Barrier - This function acts as a special kind of Data Memory Barrier. + This function acts as a special kind of Data Memory Barrier. It completes when all explicit memory accesses before this instruction complete. */ #define __DSB() __dsb(0xF) @@ -83,7 +83,7 @@ /** \brief Data Memory Barrier - This function ensures the apparent order of the explicit memory operations before + This function ensures the apparent order of the explicit memory operations before and after the instruction, without ensuring their completion. */ #define __DMB() __dmb(0xF) @@ -111,10 +111,10 @@ #else /* (__ARMCC_VERSION >= 400677) */ static __INLINE __ASM uint32_t __REV16(uint32_t value) { - rev16 r0, r0 - bx lr + rev16 r0, r0 + bx lr } -#endif /* __ARMCC_VERSION */ +#endif /* __ARMCC_VERSION */ /** \brief Reverse byte order in signed short value @@ -129,10 +129,10 @@ #else /* (__ARMCC_VERSION >= 400677) */ static __INLINE __ASM int32_t __REVSH(int32_t value) { - revsh r0, r0 - bx lr + revsh r0, r0 + bx lr } -#endif /* __ARMCC_VERSION */ +#endif /* __ARMCC_VERSION */ #if (__CORTEX_M >= 0x03) @@ -222,7 +222,7 @@ extern void __CLREX(void); #else /* (__ARMCC_VERSION >= 400000) */ #define __CLREX __clrex -#endif /* __ARMCC_VERSION */ +#endif /* __ARMCC_VERSION */ /** \brief Signed Saturate @@ -254,7 +254,7 @@ \param [in] value Value to count the leading zeros \return number of leading zeros in value */ -#define __CLZ __clz +#define __CLZ __clz #endif /* (__CORTEX_M >= 0x03) */ @@ -281,7 +281,7 @@ */ static __INLINE void __WFI(void) { - __ASM ("wfi"); + __ASM ("wfi"); } @@ -292,7 +292,7 @@ */ static __INLINE void __WFE(void) { - __ASM ("wfe"); + __ASM ("wfe"); } @@ -302,7 +302,7 @@ */ static __INLINE void __SEV(void) { - __ASM ("sev"); + __ASM ("sev"); } @@ -323,7 +323,7 @@ */ static uint32_t __REV16(uint32_t value) { - __ASM("rev16 r0, r0"); + __ASM("rev16 r0, r0"); } @@ -341,7 +341,7 @@ */ static uint32_t __RBIT(uint32_t value) { - __ASM("rbit r0, r0"); + __ASM("rbit r0, r0"); } @@ -354,7 +354,7 @@ */ static uint8_t __LDREXB(volatile uint8_t *addr) { - __ASM("ldrexb r0, [r0]"); + __ASM("ldrexb r0, [r0]"); } @@ -367,7 +367,7 @@ */ static uint16_t __LDREXH(volatile uint16_t *addr) { - __ASM("ldrexh r0, [r0]"); + __ASM("ldrexh r0, [r0]"); } @@ -381,7 +381,7 @@ /* intrinsic unsigned long __LDREX(unsigned long *) (see intrinsics.h) */ static uint32_t __LDREXW(volatile uint32_t *addr) { - __ASM("ldrex r0, [r0]"); + __ASM("ldrex r0, [r0]"); } @@ -396,7 +396,7 @@ */ static uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) { - __ASM("strexb r0, r0, [r1]"); + __ASM("strexb r0, r0, [r1]"); } @@ -411,7 +411,7 @@ */ static uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) { - __ASM("strexh r0, r0, [r1]"); + __ASM("strexh r0, r0, [r1]"); } @@ -427,7 +427,7 @@ /* intrinsic unsigned long __STREX(unsigned long, unsigned long) (see intrinsics.h )*/ static uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) { - __ASM("strex r0, r0, [r1]"); + __ASM("strex r0, r0, [r1]"); } @@ -438,7 +438,7 @@ */ static __INLINE void __CLREX(void) { - __ASM ("clrex"); + __ASM ("clrex"); } /* intrinsic unsigned char __CLZ( unsigned long ) (see intrinsics.h) */ @@ -458,7 +458,7 @@ */ __attribute__( ( always_inline ) ) static __INLINE void __NOP(void) { - __ASM volatile ("nop"); + __ASM volatile ("nop"); } @@ -469,7 +469,7 @@ */ __attribute__( ( always_inline ) ) static __INLINE void __WFI(void) { - __ASM volatile ("wfi"); + __ASM volatile ("wfi"); } @@ -480,7 +480,7 @@ */ __attribute__( ( always_inline ) ) static __INLINE void __WFE(void) { - __ASM volatile ("wfe"); + __ASM volatile ("wfe"); } @@ -490,41 +490,41 @@ */ __attribute__( ( always_inline ) ) static __INLINE void __SEV(void) { - __ASM volatile ("sev"); + __ASM volatile ("sev"); } /** \brief Instruction Synchronization Barrier - Instruction Synchronization Barrier flushes the pipeline in the processor, - so that all instructions following the ISB are fetched from cache or + Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or memory, after the instruction has been completed. */ __attribute__( ( always_inline ) ) static __INLINE void __ISB(void) { - __ASM volatile ("isb"); + __ASM volatile ("isb"); } /** \brief Data Synchronization Barrier - This function acts as a special kind of Data Memory Barrier. + This function acts as a special kind of Data Memory Barrier. It completes when all explicit memory accesses before this instruction complete. */ __attribute__( ( always_inline ) ) static __INLINE void __DSB(void) { - __ASM volatile ("dsb"); + __ASM volatile ("dsb"); } /** \brief Data Memory Barrier - This function ensures the apparent order of the explicit memory operations before + This function ensures the apparent order of the explicit memory operations before and after the instruction, without ensuring their completion. */ __attribute__( ( always_inline ) ) static __INLINE void __DMB(void) { - __ASM volatile ("dmb"); + __ASM volatile ("dmb"); } @@ -537,10 +537,10 @@ */ __attribute__( ( always_inline ) ) static __INLINE uint32_t __REV(uint32_t value) { - uint32_t result; - - __ASM volatile ("rev %0, %1" : "=r" (result) : "r" (value) ); - return(result); + uint32_t result; + +__ASM volatile ("rev %0, %1" : "=r" (result) : "r" (value) ); + return(result); } @@ -553,10 +553,10 @@ */ __attribute__( ( always_inline ) ) static __INLINE uint32_t __REV16(uint32_t value) { - uint32_t result; - - __ASM volatile ("rev16 %0, %1" : "=r" (result) : "r" (value) ); - return(result); + uint32_t result; + +__ASM volatile ("rev16 %0, %1" : "=r" (result) : "r" (value) ); + return(result); } @@ -569,10 +569,10 @@ */ __attribute__( ( always_inline ) ) static __INLINE int32_t __REVSH(int32_t value) { - uint32_t result; - - __ASM volatile ("revsh %0, %1" : "=r" (result) : "r" (value) ); - return(result); + uint32_t result; + +__ASM volatile ("revsh %0, %1" : "=r" (result) : "r" (value) ); + return(result); } @@ -587,10 +587,10 @@ */ __attribute__( ( always_inline ) ) static __INLINE uint32_t __RBIT(uint32_t value) { - uint32_t result; - - __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); - return(result); + uint32_t result; + +__ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + return(result); } @@ -604,9 +604,9 @@ __attribute__( ( always_inline ) ) static __INLINE uint8_t __LDREXB(volatile uint8_t *addr) { uint8_t result; - - __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) ); - return(result); + +__ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) ); + return(result); } @@ -620,9 +620,9 @@ __attribute__( ( always_inline ) ) static __INLINE uint16_t __LDREXH(volatile uint16_t *addr) { uint16_t result; - - __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) ); - return(result); + +__ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) ); + return(result); } @@ -636,9 +636,9 @@ __attribute__( ( always_inline ) ) static __INLINE uint32_t __LDREXW(volatile uint32_t *addr) { uint32_t result; - - __ASM volatile ("ldrex %0, [%1]" : "=r" (result) : "r" (addr) ); - return(result); + +__ASM volatile ("ldrex %0, [%1]" : "=r" (result) : "r" (addr) ); + return(result); } @@ -653,10 +653,10 @@ */ __attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) { - uint32_t result; - - __ASM volatile ("strexb %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) ); - return(result); + uint32_t result; + +__ASM volatile ("strexb %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) ); + return(result); } @@ -671,10 +671,10 @@ */ __attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) { - uint32_t result; - - __ASM volatile ("strexh %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) ); - return(result); + uint32_t result; + +__ASM volatile ("strexh %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) ); + return(result); } @@ -689,10 +689,10 @@ */ __attribute__( ( always_inline ) ) static __INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) { - uint32_t result; - - __ASM volatile ("strex %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) ); - return(result); + uint32_t result; + +__ASM volatile ("strex %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) ); + return(result); } @@ -703,7 +703,7 @@ */ __attribute__( ( always_inline ) ) static __INLINE void __CLREX(void) { - __ASM volatile ("clrex"); + __ASM volatile ("clrex"); } @@ -748,10 +748,10 @@ */ __attribute__( ( always_inline ) ) static __INLINE uint8_t __CLZ(uint32_t value) { - uint8_t result; - - __ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) ); - return(result); + uint8_t result; + +__ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) ); + return(result); } #endif /* (__CORTEX_M >= 0x03) */
--- a/el_lin.c Sat Jan 30 13:00:39 2016 +0000 +++ b/el_lin.c Sat Jan 30 13:53:19 2016 +0000 @@ -9,9 +9,9 @@ ** Version: V1.00 **-------------------------------------------------------------------------------------------------------- *********************************************************************************************************/ -#include "CyclesSync.h" -#include "CntrlGLD.h" -#include "el_lin.h" + +#include "Global.h" + #define UART1TEST #define UART1REC @@ -70,7 +70,7 @@ ** Returned value: None ** ******************************************************************************/ -int check_lcc(void) //e. CRC checking //r.ïðîâåðêà êîíòðîëüíîé ñóììû +int check_lcc(void) //e. CRC checking //r.�������� ����������� ����� { int iCRC_calc, CRC_calc = 0, CRC_real; @@ -109,12 +109,12 @@ while ((LPC_UART1->LSR & RecievBufEmpty) != 0) //e. reciever contain some information - rcv_buf[rcv_num_byt++] = LPC_UART1->RBR;//÷òåíèå èíôîðìàöèè èç áóôåðà. + rcv_buf[rcv_num_byt++] = LPC_UART1->RBR;//������ ���������� �� ������. - if (( ToWaitEnd > 25000)) //e. end part of packet is absent //r. íå äîæäàëèñü êîíöà ïàêåòà + if (( ToWaitEnd > 25000)) //e. end part of packet is absent //r. �� ��������� ����� ������ { do rcv_buf[--rcv_num_byt] = 0; @@ -142,7 +142,7 @@ return; } - if ((!ToWaitEnd) && (rcv_num_byt > 1)) //e. the header of packet has not recieved //r. îæèäàåì íà÷àëî ïàêåòà + if ((!ToWaitEnd) && (rcv_num_byt > 1)) //e. the header of packet has not recieved //r. ������� ������ ������ if ((rcv_buf[0] != 0xCC) || (( rcv_buf[1] > 2) && ( rcv_buf[1] != 0x1F))) { // L1_Rc_err (HEADER_ERR); @@ -150,14 +150,14 @@ ToWaitEnd++; return; } - // if (ErrReg != 0) //e. trying of recovering of packet //r. ñïàñåíèå ñëåäóþùåãî ïàêåòà + // if (ErrReg != 0) //e. trying of recovering of packet //r. �������� ���������� ������ // PacketSafing(); if (rcv_num_byt == 6) { if ((rcv_buf[2] == 0x0A) || (rcv_buf[2] == 0xE0) || (rcv_buf[2] == 0xE4) || (rcv_buf[2] == 0xE6) || (rcv_buf[2] == 0xE8)) - { //e. packet length is not valid, so we have the error //r. îøèáêà ðàçìåðà ïàêåòà + { //e. packet length is not valid, so we have the error //r. ������ ������� ������ ToWaitEnd++; return; } @@ -171,12 +171,12 @@ return; } } - if (check_lcc() != 0) //e. checksum is bad //r.êîíòðîëüíûå ñóììû íå ðàâíû + if (check_lcc() != 0) //e. checksum is bad //r.����������� ����� �� ����� { return; } - else //e. cheksum is not bad //r.êîíòðîëüíûå ñóììû ðàâíû + else //e. cheksum is not bad //r.����������� ����� ����� { rcv_Rdy = 1; } @@ -186,7 +186,7 @@ } /* -void L1_Rc_err (int Error) //e. error fixing and reciever restart //r. ìîäóëü ôèêñàöèè îøèáêè è ïåðåçàïóñêà ïðèåìíèêà +void L1_Rc_err (int Error) //e. error fixing and reciever restart //r. ������ �������� ������ � ����������� ��������� { int temp; line_sts |= Error; @@ -215,20 +215,20 @@ uint32_t param, param_byte, CRC; int32_t *trans_param; - if ((LPC_UART1->LSR & TRANS_SHIFT_BUF_EMPTY)) //r. ïåðåäàþùèé áóôåð ïóñò + if ((LPC_UART1->LSR & TRANS_SHIFT_BUF_EMPTY)) //r. ���������� ����� ���� if (!( LPC_GPDMACH1->CConfig & (1<<17))) LPC_GPIO2->FIOCLR |= 8; //switch off UART1 driver if (trm_ena == 0) { -// LPC_GPIO1->FIOCLR = (0x01<<30); //r.ïåðåäà÷à òðåáóåòñÿ? - return; //r. åñëè íåò, âîçâðàò +// LPC_GPIO1->FIOCLR = (0x01<<30); //r.�������� ���������? + return; //r. ���� ���, ������� } - if (!(LPC_UART1->LSR & TRANS_SHIFT_BUF_EMPTY)) //r. ïåðåäàþùèé áóôåð ïóñò + if (!(LPC_UART1->LSR & TRANS_SHIFT_BUF_EMPTY)) //r. ���������� ����� ���� return; - if ( LPC_GPDMACH1->CConfig & (1<<17)) //r. åñëè êàíàë ïåðåäà÷è çàíÿò, æäàòü + if ( LPC_GPDMACH1->CConfig & (1<<17)) //r. ���� ����� �������� �����, ����� return; //#if defined UART1TEST @@ -236,32 +236,32 @@ // LPC_GPIO2->FIOSET |= (1<<3); //e. set enable UART bit //#endif - trm_ena = 0; //r. ñáðîñèòü ôëàã ðàçðåøåíèÿ ïåðåäà÷è + trm_ena = 0; //r. �������� ���� ���������� �������� trm_num_byt = 2; - trm_buf[0] = 0x00dd; //r. çàãîëîâîê ïàêåòà - trm_buf[1] = Device_blk.Str.My_Addres; //r. àäðåñ ïðèáîðà + trm_buf[0] = 0x00dd; //r. ��������� ������ + trm_buf[1] = Device_blk.Str.My_Addres; //r. ����� ������� - CRC = trm_buf[1]; //r.èíèöèàëèçàöèÿ ñ÷åò÷èêà êîíòðîëüíîé ñóììû - for ( param = 0; param < num_of_par; param++) //r.öèêë ôîðìèðîâàíèÿ áëîêà äàííûõ ïàêåòà + CRC = trm_buf[1]; //r.������������� �������� ����������� ����� + for ( param = 0; param < num_of_par; param++) //r.���� ������������ ����� ������ ������ { - trans_param = (int32_t *)addr_param[param]; //r. ÷òåíèå àäðåñà îäíîãî èç âûäàâàåìûõ â ïàêåòå ïàðàìåòðîâ + trans_param = (int32_t *)addr_param[param]; //r. ������ ������ ������ �� ���������� � ������ ���������� for (param_byte = 0; param_byte < size_param[param]; param_byte++) { - if ( (param_byte & 0x0001) == 0 ) //r. ñ÷èòûâàåì ñòàðøèé áàéò - trm_buf[trm_num_byt] = (*trans_param >> (8/**(size_param[param]-param_byte-1)*/)) & 0x00ff; //r.ðàçìåùåíèå ïåðåäàâàåìîãî ïàðàìåòðà â ïàêåòå + if ( (param_byte & 0x0001) == 0 ) //r. ��������� ������� ���� + trm_buf[trm_num_byt] = (*trans_param >> (8/**(size_param[param]-param_byte-1)*/)) & 0x00ff; //r.���������� ������������� ��������� � ������ else { trm_buf[trm_num_byt] = *trans_param & 0x00ff; - trans_param ++; //r.ïåðåõîäèì ê ñëåäóþùåé ÿ÷åéêå ïàìÿòè + trans_param ++; //r.��������� � ��������� ������ ������ } - CRC += trm_buf[trm_num_byt]; //r. âû÷èñëåíèå òåêóùåé êîíòðîëüíîé ñóììû - trm_num_byt++; //r. êîëè÷åñòâî áèò, îòïðàâëåííûõ â ïàêåò + CRC += trm_buf[trm_num_byt]; //r. ���������� ������� ����������� ����� + trm_num_byt++; //r. ���������� ���, ������������ � ����� } } - trm_buf[trm_num_byt] = CRC >> 8; //r. çàïèñü êîíòðîëüíîé ñóììû â ïàêåò + trm_buf[trm_num_byt] = CRC >> 8; //r. ������ ����������� ����� � ����� trm_buf[trm_num_byt+1] = CRC & 0x00ff; trm_num_byt += 2;
--- a/mathDSP.c Sat Jan 30 13:00:39 2016 +0000 +++ b/mathDSP.c Sat Jan 30 13:53:19 2016 +0000 @@ -1,4 +1,5 @@ +#include "Global.h" BAND_PASS_TYPE BandPassType;
--- a/mathDSP.h Sat Jan 30 13:00:39 2016 +0000 +++ b/mathDSP.h Sat Jan 30 13:53:19 2016 +0000 @@ -1,7 +1,10 @@ -//#include "Global.h" +#ifndef mathDSP_H +#define mathDSP_H + + + #include "dspfns.h" - typedef enum BAND_PASS_TYPE_{PLC, DUP} BAND_PASS_TYPE; extern BAND_PASS_TYPE BandPassType; @@ -39,6 +42,6 @@ void init_VibroReduce(void); int PLC_PhaseDetFilt (int input); int DUP_Filt (int input); -void init_BandPass(double CenterFreq, double BandWidth, BAND_PASS_TYPE ); +void init_BandPass(double CenterFreq, double BandWidth, BAND_PASS_TYPE FiltType); - +#endif // mathDSP_H
--- a/vibro.h Sat Jan 30 13:00:39 2016 +0000 +++ b/vibro.h Sat Jan 30 13:53:19 2016 +0000 @@ -1,12 +1,7 @@ #ifndef VIBRO_H #define VIBRO_H -/* -#define SetV1 LPC_GPIO1->FIOSET=(1<<25); -#define ClrV1 LPC_GPIO1->FIOCLR = (1<<25); -#define SetV2 LPC_GPIO1->FIOSET = (1<<28); -#define ClrV2 LPC_GPIO1->FIOCLR = (1<<28); -*/ + #define LoopOn LPC_GPIO1->FIOSET = (1<<30);