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