![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
fork
Fork of LG by
Global.c@86:398da56ef751, 2016-03-24 (annotated)
- Committer:
- Kovalev_D
- Date:
- Thu Mar 24 08:20:43 2016 +0000
- Revision:
- 86:398da56ef751
- Parent:
- 52:30f2e52a493f
- Child:
- 87:7e575d26d6d0
GLD_Init
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
igor_v | 0:8ad47e2b6f00 | 1 | #include "Global.h" |
igor_v | 0:8ad47e2b6f00 | 2 | |
igor_v | 0:8ad47e2b6f00 | 3 | |
igor_v | 0:8ad47e2b6f00 | 4 | |
igor_v | 21:bc8c1cec3da6 | 5 | unsigned int VibroReg = 0; //регистр состаяния вибропривода. |
Kovalev_D | 86:398da56ef751 | 6 | unsigned long Global_Time, Time_UART,Time_Sec,Time_vibro,Time_1kHz; |
igor_v | 0:8ad47e2b6f00 | 7 | unsigned long MaxAmp=0; |
igor_v | 0:8ad47e2b6f00 | 8 | unsigned char BuffTemp[100]; |
igor_v | 51:81f47b817071 | 9 | unsigned char Time[500]; |
Kovalev_D | 86:398da56ef751 | 10 | unsigned int Event1Hz; |
Kovalev_D | 86:398da56ef751 | 11 | unsigned int Event1K ; |
Kovalev_D | 86:398da56ef751 | 12 | unsigned int Event100K; |
Kovalev_D | 86:398da56ef751 | 13 | unsigned int EventVibro; |
Kovalev_D | 86:398da56ef751 | 14 | unsigned int Time1K; |
Kovalev_D | 86:398da56ef751 | 15 | unsigned int Time100K; |
Kovalev_D | 86:398da56ef751 | 16 | unsigned int Time1Hz; |
Kovalev_D | 86:398da56ef751 | 17 | unsigned int Clock1Hz; |
Kovalev_D | 86:398da56ef751 | 18 | unsigned int ShiftD; |
Kovalev_D | 86:398da56ef751 | 19 | unsigned int ShiftL; |
Kovalev_D | 86:398da56ef751 | 20 | |
Kovalev_D | 86:398da56ef751 | 21 | void GLD_Init(void) |
Kovalev_D | 86:398da56ef751 | 22 | { |
Kovalev_D | 86:398da56ef751 | 23 | ///////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 24 | ///////////обнуление счетчиков/////////////// |
Kovalev_D | 86:398da56ef751 | 25 | ///////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 26 | Global_Time = 0; |
Kovalev_D | 86:398da56ef751 | 27 | Time_UART = 0; |
Kovalev_D | 86:398da56ef751 | 28 | Time_Sec = 0; |
Kovalev_D | 86:398da56ef751 | 29 | Time_vibro = 0; |
Kovalev_D | 86:398da56ef751 | 30 | Time_1kHz = 0; |
Kovalev_D | 86:398da56ef751 | 31 | Event1Hz = 0; |
Kovalev_D | 86:398da56ef751 | 32 | Event1K = 0; |
Kovalev_D | 86:398da56ef751 | 33 | Event100K = 0; |
Kovalev_D | 86:398da56ef751 | 34 | EventVibro = 0; |
Kovalev_D | 86:398da56ef751 | 35 | Time1K = 0; |
Kovalev_D | 86:398da56ef751 | 36 | Time100K = 0; |
Kovalev_D | 86:398da56ef751 | 37 | Time1Hz = 0; |
Kovalev_D | 86:398da56ef751 | 38 | Clock1Hz = 0; |
Kovalev_D | 86:398da56ef751 | 39 | ShiftD = 0; |
Kovalev_D | 86:398da56ef751 | 40 | ShiftL = 0; |
Kovalev_D | 86:398da56ef751 | 41 | ///////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 42 | ///////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 43 | |
Kovalev_D | 86:398da56ef751 | 44 | /* |
Kovalev_D | 86:398da56ef751 | 45 | Gyro.SOC_Out=0xDD; |
Kovalev_D | 86:398da56ef751 | 46 | Gyro.Firmware_Version =0x15; //версия программы |
Kovalev_D | 86:398da56ef751 | 47 | Gyro.GLD_Serial = 0x20; //серийный номер |
Kovalev_D | 86:398da56ef751 | 48 | Gyro.My_Addres = 0; //адрес глд |
Kovalev_D | 86:398da56ef751 | 49 | Gyro.Discharg = StartDischarg; |
Kovalev_D | 86:398da56ef751 | 50 | Gyro.BackLight = StartBackLight; |
Kovalev_D | 86:398da56ef751 | 51 | */ |
Kovalev_D | 86:398da56ef751 | 52 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 53 | ////////инициализация цап (р0.26 цап выход)////////// |
Kovalev_D | 86:398da56ef751 | 54 | //////////////////середина шкалы///////////////////// |
Kovalev_D | 86:398da56ef751 | 55 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 56 | LPC_PINCON->PINSEL1 = 0x00200000; |
Kovalev_D | 86:398da56ef751 | 57 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 58 | ////////////начальное значение для цап/////////////// |
Kovalev_D | 86:398da56ef751 | 59 | //////////////////середина шкалы///////////////////// |
Kovalev_D | 86:398da56ef751 | 60 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 61 | Spi.DAC_A = 0x7fff; |
Kovalev_D | 86:398da56ef751 | 62 | Spi.DAC_B = 0x7fff; |
Kovalev_D | 86:398da56ef751 | 63 | //////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 64 | /////////////поправочный коэффициент///////////////// |
Kovalev_D | 86:398da56ef751 | 65 | /////////для цапов (граници +-12.5 вольт)//////////// |
Kovalev_D | 86:398da56ef751 | 66 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 67 | K_DAC=65535.0/(65535.0+(deltaDAC+deltaDAC/2)); |
Kovalev_D | 86:398da56ef751 | 68 | K_DAC=0.8; |
Kovalev_D | 86:398da56ef751 | 69 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 70 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 71 | |
igor_v | 16:18e3fd7b92d0 | 72 | |
igor_v | 16:18e3fd7b92d0 | 73 | |
Kovalev_D | 86:398da56ef751 | 74 | secPuls =0;// переменная для конопки поджига аск глд(временная) |
Kovalev_D | 86:398da56ef751 | 75 | |
Kovalev_D | 86:398da56ef751 | 76 | |
Kovalev_D | 86:398da56ef751 | 77 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 78 | /////////////обнуление переменых для///////////////// |
Kovalev_D | 86:398da56ef751 | 79 | ///////////////переменных энкодера/////////////////// |
Kovalev_D | 86:398da56ef751 | 80 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 81 | Cur_QEI=0; |
Kovalev_D | 86:398da56ef751 | 82 | Last_QEI=0; |
Kovalev_D | 86:398da56ef751 | 83 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 84 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 85 | |
Kovalev_D | 86:398da56ef751 | 86 | |
Kovalev_D | 86:398da56ef751 | 87 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 88 | /////////////обнуление переменых для///////////////// |
Kovalev_D | 86:398da56ef751 | 89 | ///////////расчета значений буферов ВП/////////////// |
Kovalev_D | 86:398da56ef751 | 90 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 91 | CuruAngle = 0; |
Kovalev_D | 86:398da56ef751 | 92 | Pulse_8Point = 0; |
Kovalev_D | 86:398da56ef751 | 93 | Pulse_16Point = 0; |
Kovalev_D | 86:398da56ef751 | 94 | Pulse_16PointD = 0; |
Kovalev_D | 86:398da56ef751 | 95 | Pulse_32Point = 0; |
Kovalev_D | 86:398da56ef751 | 96 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 97 | /////////////предварительное заполнение////////////// |
Kovalev_D | 86:398da56ef751 | 98 | ////////////////буферов вибропривода///////////////// |
Kovalev_D | 86:398da56ef751 | 99 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 100 | for (int i = 0; i < 32; i++ ) { |
Kovalev_D | 86:398da56ef751 | 101 | |
Kovalev_D | 86:398da56ef751 | 102 | Buff_16Point[i] = 0x00; |
Kovalev_D | 86:398da56ef751 | 103 | Buff_8Point[i] = 0x00; |
Kovalev_D | 86:398da56ef751 | 104 | Buff_32Point[i] = 0x00; |
Kovalev_D | 86:398da56ef751 | 105 | Buff_16PointD[i] = 0x00; |
Kovalev_D | 86:398da56ef751 | 106 | } |
Kovalev_D | 86:398da56ef751 | 107 | //////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 108 | //////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 109 | |
Kovalev_D | 86:398da56ef751 | 110 | |
Kovalev_D | 86:398da56ef751 | 111 | |
Kovalev_D | 86:398da56ef751 | 112 | |
Kovalev_D | 86:398da56ef751 | 113 | |
Kovalev_D | 86:398da56ef751 | 114 | |
Kovalev_D | 86:398da56ef751 | 115 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 116 | /////////////обнуление переменых для///////////////// |
Kovalev_D | 86:398da56ef751 | 117 | //////////////////переменных ацп///////////////////// |
Kovalev_D | 86:398da56ef751 | 118 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 119 | Temp_AMP=0; |
Kovalev_D | 86:398da56ef751 | 120 | Temp_ADC_2=0; |
Kovalev_D | 86:398da56ef751 | 121 | Temp_ADC_3=0; |
Kovalev_D | 86:398da56ef751 | 122 | Temp_ADC_4=0; |
Kovalev_D | 86:398da56ef751 | 123 | Temp_ADC_5=0; |
Kovalev_D | 86:398da56ef751 | 124 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 125 | /////////////предварительное заполнение////////////// |
Kovalev_D | 86:398da56ef751 | 126 | /////////////////////буферов АЦП///////////////////// |
Kovalev_D | 86:398da56ef751 | 127 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 128 | for (int i = 0; i < 16; i++ ) { |
Kovalev_D | 86:398da56ef751 | 129 | Buff_ADC_1[i] = 0; // ампл ацп. |
Kovalev_D | 86:398da56ef751 | 130 | Buff_ADC_2[i] = 0; |
Kovalev_D | 86:398da56ef751 | 131 | Buff_ADC_3[i] = 0; |
Kovalev_D | 86:398da56ef751 | 132 | Buff_ADC_4[i] = 0; |
Kovalev_D | 86:398da56ef751 | 133 | Buff_ADC_5[i] = 0; |
Kovalev_D | 86:398da56ef751 | 134 | } |
Kovalev_D | 86:398da56ef751 | 135 | //////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 136 | //////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 137 | |
Kovalev_D | 86:398da56ef751 | 138 | |
Kovalev_D | 86:398da56ef751 | 139 | |
Kovalev_D | 86:398da56ef751 | 140 | |
Kovalev_D | 86:398da56ef751 | 141 | |
Kovalev_D | 86:398da56ef751 | 142 | |
Kovalev_D | 86:398da56ef751 | 143 | /////////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 144 | Init_Pin(); |
Kovalev_D | 86:398da56ef751 | 145 | init_Vibro(); |
Kovalev_D | 86:398da56ef751 | 146 | init_timer(TIME_INTERVAL ); //Timer 1: CCLK / 7812 = 12800.819Hz; Vibro: Timer1/32 = 400.025Hz; 10ms??? |
Kovalev_D | 86:398da56ef751 | 147 | enable_timer1(); |
Kovalev_D | 86:398da56ef751 | 148 | Init_TIM2(); //Timer 2: CCLK / 4 / 250 = 100kHz |
Kovalev_D | 86:398da56ef751 | 149 | enable_timer2(); |
Kovalev_D | 86:398da56ef751 | 150 | |
Kovalev_D | 86:398da56ef751 | 151 | } |
igor_v | 13:e2a1d18677b8 | 152 | |
igor_v | 30:17c84ed091b3 | 153 | void ButtonLightUP(void) // включение аоджига и подсветки |
igor_v | 0:8ad47e2b6f00 | 154 | { |
igor_v | 52:30f2e52a493f | 155 | |
igor_v | 0:8ad47e2b6f00 | 156 | if ((secPuls>100)&&(pulse_Rq==1)) |
igor_v | 0:8ad47e2b6f00 | 157 | { |
igor_v | 0:8ad47e2b6f00 | 158 | pulse_Rq=0; |
igor_v | 30:17c84ed091b3 | 159 | // LightUpCount=3000; |
igor_v | 30:17c84ed091b3 | 160 | // BackLightCount=5000; |
igor_v | 30:17c84ed091b3 | 161 | |
igor_v | 0:8ad47e2b6f00 | 162 | } |
igor_v | 0:8ad47e2b6f00 | 163 | } |
igor_v | 0:8ad47e2b6f00 | 164 | |
igor_v | 0:8ad47e2b6f00 | 165 | |
igor_v | 0:8ad47e2b6f00 | 166 | |
igor_v | 0:8ad47e2b6f00 | 167 | |
igor_v | 0:8ad47e2b6f00 | 168 |