![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
fork
Fork of LG by
MTimer.c@215:b58b887fd367, 2017-08-29 (annotated)
- Committer:
- Kovalev_D
- Date:
- Tue Aug 29 06:33:08 2017 +0000
- Revision:
- 215:b58b887fd367
- Parent:
- 214:4c70e452c491
- Child:
- 216:189b0ea1dc38
dcd
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
igor_v | 0:8ad47e2b6f00 | 1 | #include "MTimer.h" |
igor_v | 0:8ad47e2b6f00 | 2 | #include "LPC17xx.h" |
igor_v | 0:8ad47e2b6f00 | 3 | #include "MTimer.h" |
igor_v | 0:8ad47e2b6f00 | 4 | #include "vibro.h" |
igor_v | 0:8ad47e2b6f00 | 5 | #include "QEI.h" |
igor_v | 0:8ad47e2b6f00 | 6 | #include "Global.h" |
igor_v | 0:8ad47e2b6f00 | 7 | #include "SPI.h" |
igor_v | 0:8ad47e2b6f00 | 8 | #include "InputOutput.h" |
Kovalev_D | 112:4a96133a1311 | 9 | |
Kovalev_D | 197:7a05523bf588 | 10 | unsigned int CountV64=0; |
igor_v | 0:8ad47e2b6f00 | 11 | unsigned int CountV31=0; |
Kovalev_D | 197:7a05523bf588 | 12 | unsigned int CountV255=0; |
Kovalev_D | 215:b58b887fd367 | 13 | unsigned int CountV511=0; |
Kovalev_D | 209:224e7331a061 | 14 | unsigned int f,MODCount=0; |
Kovalev_D | 124:9ae09249f842 | 15 | int loop=0; |
Kovalev_D | 208:19150d2b528f | 16 | int t; |
Kovalev_D | 88:b5c1d9d338d1 | 17 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 18 | /////////////////////EVENT/////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 19 | ///////////////////////////////////////////////////// |
Kovalev_D | 89:a0d344db227e | 20 | ///////////////////////////////////////////////////// |
Kovalev_D | 214:4c70e452c491 | 21 | ///////////////////// 1250Hz /////////////////////////// |
Kovalev_D | 214:4c70e452c491 | 22 | ///////////////////////////////////////////////////// |
Kovalev_D | 214:4c70e452c491 | 23 | void Event_1250Hz(void)// событие раз в 1,25 КГц |
Kovalev_D | 214:4c70e452c491 | 24 | { |
Kovalev_D | 214:4c70e452c491 | 25 | if(Event1250Hz) |
Kovalev_D | 214:4c70e452c491 | 26 | { |
Kovalev_D | 214:4c70e452c491 | 27 | Gyro.EvenRate7=1; |
Kovalev_D | 215:b58b887fd367 | 28 | |
Kovalev_D | 214:4c70e452c491 | 29 | Event1250Hz--; |
Kovalev_D | 215:b58b887fd367 | 30 | |
Kovalev_D | 214:4c70e452c491 | 31 | } |
Kovalev_D | 214:4c70e452c491 | 32 | } |
Kovalev_D | 214:4c70e452c491 | 33 | ///////////////////////////////////////////////////// |
Kovalev_D | 89:a0d344db227e | 34 | ///////////////////// 1Hz /////////////////////////// |
Kovalev_D | 89:a0d344db227e | 35 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 36 | void Event_1Hz(void)// событие раз в 1 Гц |
Kovalev_D | 214:4c70e452c491 | 37 | { static int tempdac=0,tempdac1; |
Kovalev_D | 115:e5a230e5af52 | 38 | if (Event1Hz) |
Kovalev_D | 208:19150d2b528f | 39 | { |
Kovalev_D | 215:b58b887fd367 | 40 | |
Kovalev_D | 215:b58b887fd367 | 41 | |
Kovalev_D | 215:b58b887fd367 | 42 | /* for(int q=0; q<64; q++) |
Kovalev_D | 215:b58b887fd367 | 43 | { |
Kovalev_D | 215:b58b887fd367 | 44 | if( Buff_Restored_Mod[(q-Gyro.PLC_Phase)& 0x3f ] > 0) sprintf((Time)," 1 "); |
Kovalev_D | 215:b58b887fd367 | 45 | else sprintf((Time)," 0 "); |
Kovalev_D | 215:b58b887fd367 | 46 | WriteCon(Time); |
Kovalev_D | 215:b58b887fd367 | 47 | } |
Kovalev_D | 215:b58b887fd367 | 48 | sprintf((Time)," \r\n "); |
Kovalev_D | 215:b58b887fd367 | 49 | WriteCon(Time); |
Kovalev_D | 215:b58b887fd367 | 50 | */ |
Kovalev_D | 215:b58b887fd367 | 51 | |
Kovalev_D | 215:b58b887fd367 | 52 | |
Kovalev_D | 215:b58b887fd367 | 53 | |
Kovalev_D | 214:4c70e452c491 | 54 | /* Check(BuffTemp, 8); |
Kovalev_D | 214:4c70e452c491 | 55 | WriteConN (BuffTemp,8);*/ |
Kovalev_D | 215:b58b887fd367 | 56 | /* sprintf((Time)," %d \r\n", Gyro.PLC_regul); |
Kovalev_D | 215:b58b887fd367 | 57 | WriteCon(Time);*/ |
Kovalev_D | 215:b58b887fd367 | 58 | /* if(Gyro.RgConA&0x8) |
Kovalev_D | 215:b58b887fd367 | 59 | { |
Kovalev_D | 215:b58b887fd367 | 60 | if(Gyro.PLC_regul>0){Spi.DAC_B-=Gyro.PLC_regul*Gyro.PLC_Gain;} |
Kovalev_D | 215:b58b887fd367 | 61 | else {Spi.DAC_B+=Gyro.PLC_regul*Gyro.PLC_Gain;} |
Kovalev_D | 215:b58b887fd367 | 62 | } |
Kovalev_D | 215:b58b887fd367 | 63 | Gyro.PLC_regul=0;*/ |
Kovalev_D | 214:4c70e452c491 | 64 | /* sprintf((Time)," %d %d \r\n", Spi.DAC_A,Gyro.DacIn); |
Kovalev_D | 214:4c70e452c491 | 65 | WriteCon(Time);*/ |
Kovalev_D | 213:9953db9543d6 | 66 | if(Gyro.LogMod==1) ShowMod2(); |
Kovalev_D | 208:19150d2b528f | 67 | Discharg(); |
Kovalev_D | 208:19150d2b528f | 68 | BackLight(); |
Kovalev_D | 208:19150d2b528f | 69 | Gyro.Rate1_Event = 1; |
Kovalev_D | 208:19150d2b528f | 70 | Event1Hz--; |
Kovalev_D | 208:19150d2b528f | 71 | Time1Hz++; |
Kovalev_D | 214:4c70e452c491 | 72 | // sprintf((Time),"%d \r\n",Gyro.ModeOut ); |
Kovalev_D | 214:4c70e452c491 | 73 | // WriteCon(Time); |
Kovalev_D | 214:4c70e452c491 | 74 | |
Kovalev_D | 214:4c70e452c491 | 75 | } |
Kovalev_D | 88:b5c1d9d338d1 | 76 | } |
Kovalev_D | 89:a0d344db227e | 77 | ///////////////////////////////////////////////////// |
Kovalev_D | 89:a0d344db227e | 78 | ///////////////////// 1kHz ////////////////////////// |
Kovalev_D | 197:7a05523bf588 | 79 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 80 | void Event_1KHz(void)// событие раз в 1 кГц |
Kovalev_D | 214:4c70e452c491 | 81 | { if (Event1K) |
Kovalev_D | 116:66f1f0ff2dab | 82 | { |
Kovalev_D | 214:4c70e452c491 | 83 | if(Gyro.PLCDelay) Gyro.PLCDelay--; |
Kovalev_D | 88:b5c1d9d338d1 | 84 | Event1K --; |
Kovalev_D | 215:b58b887fd367 | 85 | |
Kovalev_D | 116:66f1f0ff2dab | 86 | Time1K++;//первый ++ работает каждые 125 (event100kHz)второй был в 100 кГц |
Kovalev_D | 209:224e7331a061 | 87 | if (Time1K > 1000) |
Kovalev_D | 115:e5a230e5af52 | 88 | { |
Kovalev_D | 208:19150d2b528f | 89 | Time1K -=1000; |
Kovalev_D | 88:b5c1d9d338d1 | 90 | Event1Hz ++; |
Kovalev_D | 88:b5c1d9d338d1 | 91 | } |
Kovalev_D | 209:224e7331a061 | 92 | |
Kovalev_D | 214:4c70e452c491 | 93 | } |
Kovalev_D | 88:b5c1d9d338d1 | 94 | } |
Kovalev_D | 209:224e7331a061 | 95 | |
Kovalev_D | 209:224e7331a061 | 96 | void Event_2KHz(void)// событие раз в 1 кГц |
Kovalev_D | 214:4c70e452c491 | 97 | {int temp=0; |
Kovalev_D | 214:4c70e452c491 | 98 | |
Kovalev_D | 209:224e7331a061 | 99 | if (Event2K) |
Kovalev_D | 215:b58b887fd367 | 100 | { |
Kovalev_D | 215:b58b887fd367 | 101 | if(Gyro.LogMod) |
Kovalev_D | 215:b58b887fd367 | 102 | { |
Kovalev_D | 215:b58b887fd367 | 103 | /* sprintf((Time)," %d %d %d %d \r\n", TSinMns, TSinPls, TSinMns - TSinPls, Gyro.PLC_Eror_count); |
Kovalev_D | 215:b58b887fd367 | 104 | WriteCon(Time);*/ |
Kovalev_D | 213:9953db9543d6 | 105 | } |
Kovalev_D | 209:224e7331a061 | 106 | Event2K --; |
Kovalev_D | 215:b58b887fd367 | 107 | //Gyro.Rate3_Event++; |
Kovalev_D | 209:224e7331a061 | 108 | } |
Kovalev_D | 209:224e7331a061 | 109 | } |
Kovalev_D | 124:9ae09249f842 | 110 | void Event_500Hz(void)// событие раз в 500 Гц |
Kovalev_D | 124:9ae09249f842 | 111 | { |
Kovalev_D | 124:9ae09249f842 | 112 | if(Event500Hz) |
Kovalev_D | 211:ac8251b067d2 | 113 | { |
Kovalev_D | 215:b58b887fd367 | 114 | /* if(Gyro.LogMod==5) |
Kovalev_D | 215:b58b887fd367 | 115 | { |
Kovalev_D | 215:b58b887fd367 | 116 | } */ |
Kovalev_D | 205:775d54fdf646 | 117 | Event500Hz--; |
Kovalev_D | 208:19150d2b528f | 118 | Gyro.Event_500Hz=1;// Event 500Гц выдачи данных для постройки графика управления вибро |
Kovalev_D | 197:7a05523bf588 | 119 | } |
Kovalev_D | 197:7a05523bf588 | 120 | } |
Kovalev_D | 209:224e7331a061 | 121 | void Event_250Hz(void) |
Kovalev_D | 209:224e7331a061 | 122 | { |
Kovalev_D | 209:224e7331a061 | 123 | if(Event250Hz) |
Kovalev_D | 209:224e7331a061 | 124 | { |
Kovalev_D | 209:224e7331a061 | 125 | |
Kovalev_D | 209:224e7331a061 | 126 | // Gyro.CuruAngle=0; |
Kovalev_D | 209:224e7331a061 | 127 | Event250Hz--; |
Kovalev_D | 209:224e7331a061 | 128 | MODCount++; |
Kovalev_D | 209:224e7331a061 | 129 | if((MODCount&0x3f)==0) |
Kovalev_D | 209:224e7331a061 | 130 | {/* |
Kovalev_D | 209:224e7331a061 | 131 | sprintf((Time),"%d %d %d\r\n", Spi.DAC_B, (0xffff - Spi.ADC5), Gyro.CuruAngle); |
Kovalev_D | 209:224e7331a061 | 132 | WriteCon(Time); |
Kovalev_D | 209:224e7331a061 | 133 | Gyro.CuruAngle = 0; |
Kovalev_D | 209:224e7331a061 | 134 | Gyro.CaunMinRate = 0; |
Kovalev_D | 209:224e7331a061 | 135 | Gyro.CaunPlusRate = 0; |
Kovalev_D | 209:224e7331a061 | 136 | */ |
Kovalev_D | 209:224e7331a061 | 137 | } |
Kovalev_D | 215:b58b887fd367 | 138 | |
Kovalev_D | 209:224e7331a061 | 139 | if(MODFlag==2) |
Kovalev_D | 209:224e7331a061 | 140 | { |
Kovalev_D | 214:4c70e452c491 | 141 | /* BuffADC_64Point[MODCount&0x3f]=ADC5New;*/ |
Kovalev_D | 209:224e7331a061 | 142 | LPC_DAC->DACR = (ModArraySin[MODCount&0x3f] * Gyro.ModAmp); |
Kovalev_D | 209:224e7331a061 | 143 | |
Kovalev_D | 209:224e7331a061 | 144 | if((MODCount&0x3f)==0) PLCRegul250(); |
Kovalev_D | 209:224e7331a061 | 145 | } |
Kovalev_D | 209:224e7331a061 | 146 | } |
Kovalev_D | 209:224e7331a061 | 147 | } |
Kovalev_D | 89:a0d344db227e | 148 | ///////////////////////////////////////////////////// |
Kovalev_D | 89:a0d344db227e | 149 | ///////////////////// 100kHz ////////////////////////// |
Kovalev_D | 89:a0d344db227e | 150 | ///////////////////////////////////////////////////// |
Kovalev_D | 193:a0fe8bfc97e4 | 151 | void Event_100KHz(void)// событие раз в 100 кГц |
Kovalev_D | 88:b5c1d9d338d1 | 152 | { |
Kovalev_D | 162:44e4ded32c6a | 153 | |
Kovalev_D | 88:b5c1d9d338d1 | 154 | if (Event100K) { |
Kovalev_D | 197:7a05523bf588 | 155 | |
Kovalev_D | 88:b5c1d9d338d1 | 156 | Event100K --; |
Kovalev_D | 197:7a05523bf588 | 157 | |
Kovalev_D | 124:9ae09249f842 | 158 | if (OutBufCon1Count)OutBufCon1Count--; // обратный отсчет для управления ногой и формирование задержки на выдачу |
Kovalev_D | 124:9ae09249f842 | 159 | |
Kovalev_D | 124:9ae09249f842 | 160 | PinCheng(); // чтение регистра состояния выводов(вибро, полсветка, поджиг, LED) и управление выводами. |
Kovalev_D | 88:b5c1d9d338d1 | 161 | } |
Kovalev_D | 88:b5c1d9d338d1 | 162 | } |
Kovalev_D | 89:a0d344db227e | 163 | ///////////////////////////////////////////////////// |
Kovalev_D | 89:a0d344db227e | 164 | //////////////////vibro EVENT//////////////////////// |
Kovalev_D | 89:a0d344db227e | 165 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 166 | void Event_Vibro(void)// событие от вибр |
Kovalev_D | 88:b5c1d9d338d1 | 167 | { |
Kovalev_D | 88:b5c1d9d338d1 | 168 | if (EventVibro) { |
Kovalev_D | 88:b5c1d9d338d1 | 169 | EventVibro --; |
Kovalev_D | 88:b5c1d9d338d1 | 170 | } |
Kovalev_D | 88:b5c1d9d338d1 | 171 | } |
Kovalev_D | 89:a0d344db227e | 172 | ///////////////////////////////////////////////////// |
Kovalev_D | 89:a0d344db227e | 173 | ///////////////////////////////////////////////////// |
Kovalev_D | 89:a0d344db227e | 174 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 175 | |
Kovalev_D | 88:b5c1d9d338d1 | 176 | |
Kovalev_D | 112:4a96133a1311 | 177 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 112:4a96133a1311 | 178 | ////////////////////////////////////////////////////////TIMER1//////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 112:4a96133a1311 | 179 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 112:4a96133a1311 | 180 | |
Kovalev_D | 112:4a96133a1311 | 181 | ////////////////////////////////////////////////////////////////////// |
Kovalev_D | 112:4a96133a1311 | 182 | /////////////////////инициализация таймера 1 ///////////////////////// |
Kovalev_D | 112:4a96133a1311 | 183 | ////////////////////////////////////////////////////////////////////// |
Kovalev_D | 112:4a96133a1311 | 184 | |
Kovalev_D | 112:4a96133a1311 | 185 | unsigned int Init_TIM1 (unsigned int TimerInterval ) |
Kovalev_D | 112:4a96133a1311 | 186 | { |
Kovalev_D | 214:4c70e452c491 | 187 | // LPC_SC->PCLKSEL0 |= (1<<4); |
Kovalev_D | 112:4a96133a1311 | 188 | LPC_TIM1->MR0 = TimerInterval; |
Kovalev_D | 112:4a96133a1311 | 189 | LPC_TIM1->MCR = 3; /* Interrupt and Reset on MR1 */ |
Kovalev_D | 112:4a96133a1311 | 190 | NVIC_EnableIRQ(TIMER1_IRQn); |
Kovalev_D | 112:4a96133a1311 | 191 | } |
Kovalev_D | 112:4a96133a1311 | 192 | |
Kovalev_D | 112:4a96133a1311 | 193 | |
igor_v | 0:8ad47e2b6f00 | 194 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 195 | /////////////////////////включение таймера 1////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 196 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 197 | void enable_timer1( void ) |
igor_v | 21:bc8c1cec3da6 | 198 | { |
igor_v | 21:bc8c1cec3da6 | 199 | LPC_TIM1->TCR = 1; |
igor_v | 21:bc8c1cec3da6 | 200 | return; |
igor_v | 21:bc8c1cec3da6 | 201 | } |
igor_v | 0:8ad47e2b6f00 | 202 | |
igor_v | 0:8ad47e2b6f00 | 203 | |
igor_v | 0:8ad47e2b6f00 | 204 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 205 | /////////////////////////////////////////////////TIMER2////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 206 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 207 | |
igor_v | 0:8ad47e2b6f00 | 208 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 209 | /////////////////////инициализация таймера 2 ///////////////////////// |
igor_v | 0:8ad47e2b6f00 | 210 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 211 | unsigned int Init_TIM2 (void) |
igor_v | 21:bc8c1cec3da6 | 212 | { |
Kovalev_D | 124:9ae09249f842 | 213 | LPC_TIM2->MR0 = 257; |
igor_v | 21:bc8c1cec3da6 | 214 | LPC_TIM2->MCR = 3; /* Interrupt and Reset on MR0 */ |
igor_v | 21:bc8c1cec3da6 | 215 | NVIC_EnableIRQ(TIMER2_IRQn); |
igor_v | 21:bc8c1cec3da6 | 216 | return 1; |
igor_v | 21:bc8c1cec3da6 | 217 | } |
igor_v | 0:8ad47e2b6f00 | 218 | |
igor_v | 21:bc8c1cec3da6 | 219 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 220 | /////////////////////////включение таймера 2////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 221 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 222 | void enable_timer2(void) |
igor_v | 21:bc8c1cec3da6 | 223 | { |
igor_v | 21:bc8c1cec3da6 | 224 | LPC_TIM2->TCR = 1; |
igor_v | 21:bc8c1cec3da6 | 225 | LPC_TIM2->TCR = 0x01; |
igor_v | 21:bc8c1cec3da6 | 226 | } |
igor_v | 21:bc8c1cec3da6 | 227 | |
igor_v | 21:bc8c1cec3da6 | 228 | |
Kovalev_D | 112:4a96133a1311 | 229 | ////////////////////////////////////////////////////////////////////// |
Kovalev_D | 112:4a96133a1311 | 230 | /////////////////////////прерывание таймера 1////////////////////////// |
Kovalev_D | 112:4a96133a1311 | 231 | ////////////////////////////////////////////////////////////////////// |
Kovalev_D | 215:b58b887fd367 | 232 | __irq void TIMER1_IRQHandler (void)//13.27 kHz(vibro*32) |
Kovalev_D | 205:775d54fdf646 | 233 | { |
Kovalev_D | 208:19150d2b528f | 234 | |
Kovalev_D | 208:19150d2b528f | 235 | |
igor_v | 114:5cc38a53d8a7 | 236 | ResetCS(ADC); //prepare ADC for sampling |
Kovalev_D | 112:4a96133a1311 | 237 | SetDAC(DAC); |
Kovalev_D | 208:19150d2b528f | 238 | Global_Time++; |
igor_v | 114:5cc38a53d8a7 | 239 | CountV255++; // инкремент счеттчика |
Kovalev_D | 215:b58b887fd367 | 240 | CountV511++; |
Kovalev_D | 164:6f43f85fdd8d | 241 | CountV255 &= 0xff; // ОБРЕЗАНИЕ СЧЕТЧИКА |
Kovalev_D | 215:b58b887fd367 | 242 | CountV511 &= 0x1ff; |
Kovalev_D | 197:7a05523bf588 | 243 | CountV64 = CountV255 & 0x3f; |
Kovalev_D | 197:7a05523bf588 | 244 | CountV31 = CountV255 & 0x1f; // малый счетчик |
Kovalev_D | 197:7a05523bf588 | 245 | |
Kovalev_D | 112:4a96133a1311 | 246 | D_QEI(); //чтение данных по счетчику |
Kovalev_D | 143:2b15794a6cd2 | 247 | cheng(); // выставление флагов в 32 тактном цикле. |
Kovalev_D | 116:66f1f0ff2dab | 248 | |
Kovalev_D | 116:66f1f0ff2dab | 249 | |
Kovalev_D | 116:66f1f0ff2dab | 250 | SetCS(ADC); //start ADC sampling |
Kovalev_D | 116:66f1f0ff2dab | 251 | ResetDAC(DAC); |
Kovalev_D | 197:7a05523bf588 | 252 | SPI_Exchange(); //Чтение ADC_SPI |
igor_v | 114:5cc38a53d8a7 | 253 | |
Kovalev_D | 214:4c70e452c491 | 254 | LPC_TIM1->IR = 1; |
Kovalev_D | 208:19150d2b528f | 255 | |
Kovalev_D | 112:4a96133a1311 | 256 | } |
Kovalev_D | 112:4a96133a1311 | 257 | |
igor_v | 21:bc8c1cec3da6 | 258 | /////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 259 | /////////////////////////прерывание таймера 2////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 260 | /////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 261 | __irq void TIMER2_IRQHandler (void) |
Kovalev_D | 210:b02fa166315d | 262 | { |
Kovalev_D | 213:9953db9543d6 | 263 | /// LoopOn |
igor_v | 21:bc8c1cec3da6 | 264 | LPC_TIM2->IR = 1; |
Kovalev_D | 213:9953db9543d6 | 265 | if (Gyro.UARTFlag) |
Kovalev_D | 213:9953db9543d6 | 266 | { |
Kovalev_D | 213:9953db9543d6 | 267 | if(Time_UART) Time_UART--; |
Kovalev_D | 213:9953db9543d6 | 268 | } |
Kovalev_D | 214:4c70e452c491 | 269 | // |
Kovalev_D | 214:4c70e452c491 | 270 | |
igor_v | 21:bc8c1cec3da6 | 271 | Time_vibro++; |
Kovalev_D | 214:4c70e452c491 | 272 | // VibroOut(); |
Kovalev_D | 112:4a96133a1311 | 273 | Gyro.VibroOutF=1; |
Kovalev_D | 214:4c70e452c491 | 274 | Event100K ++; |
Kovalev_D | 214:4c70e452c491 | 275 | Time1250Hz++; |
Kovalev_D | 197:7a05523bf588 | 276 | Time500Hz++; |
Kovalev_D | 209:224e7331a061 | 277 | Time250Hz++; |
Kovalev_D | 197:7a05523bf588 | 278 | Time100K++; |
Kovalev_D | 209:224e7331a061 | 279 | Time2K++; |
Kovalev_D | 209:224e7331a061 | 280 | //Time2K++; |
Kovalev_D | 205:775d54fdf646 | 281 | // Time250Hz++; |
Kovalev_D | 214:4c70e452c491 | 282 | |
Kovalev_D | 214:4c70e452c491 | 283 | if (Time1250Hz > 79) |
Kovalev_D | 214:4c70e452c491 | 284 | { |
Kovalev_D | 214:4c70e452c491 | 285 | Time1250Hz -= 80; |
Kovalev_D | 214:4c70e452c491 | 286 | Event1250Hz ++; |
Kovalev_D | 214:4c70e452c491 | 287 | } |
Kovalev_D | 197:7a05523bf588 | 288 | if (Time100K == 100) |
Kovalev_D | 214:4c70e452c491 | 289 | { // LoopOn |
Kovalev_D | 197:7a05523bf588 | 290 | Time100K = 0; |
Kovalev_D | 197:7a05523bf588 | 291 | Event1K ++; |
Kovalev_D | 214:4c70e452c491 | 292 | // LoopOn |
Kovalev_D | 197:7a05523bf588 | 293 | } |
Kovalev_D | 209:224e7331a061 | 294 | |
Kovalev_D | 215:b58b887fd367 | 295 | if (Time2K== 20000) |
Kovalev_D | 209:224e7331a061 | 296 | { Time2K=0; |
Kovalev_D | 209:224e7331a061 | 297 | //Time100K = 0; |
Kovalev_D | 209:224e7331a061 | 298 | Event2K ++; |
Kovalev_D | 209:224e7331a061 | 299 | } |
Kovalev_D | 209:224e7331a061 | 300 | |
Kovalev_D | 197:7a05523bf588 | 301 | if (Time500Hz > 200) |
Kovalev_D | 208:19150d2b528f | 302 | { // LoopOn |
Kovalev_D | 197:7a05523bf588 | 303 | Time500Hz -= 200; |
Kovalev_D | 208:19150d2b528f | 304 | Event500Hz ++; |
Kovalev_D | 197:7a05523bf588 | 305 | } |
Kovalev_D | 209:224e7331a061 | 306 | |
Kovalev_D | 209:224e7331a061 | 307 | if (Time250Hz > 6) |
Kovalev_D | 209:224e7331a061 | 308 | { // LoopOn |
Kovalev_D | 209:224e7331a061 | 309 | Time250Hz -= 6; |
Kovalev_D | 209:224e7331a061 | 310 | Event250Hz ++; |
Kovalev_D | 209:224e7331a061 | 311 | } |
Kovalev_D | 210:b02fa166315d | 312 | |
Kovalev_D | 213:9953db9543d6 | 313 | //LoopOff |
igor_v | 21:bc8c1cec3da6 | 314 | } |