![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
forkd
Fork of LGstaandart by
MTimer.c@225:f8fee6c586cc, 2017-12-12 (annotated)
- Committer:
- Kovalev_D
- Date:
- Tue Dec 12 05:53:39 2017 +0000
- Revision:
- 225:f8fee6c586cc
- Parent:
- 222:7de7b3bf3a1d
- Child:
- 226:4a4d5bd5fcd7
new asc_gld
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 | 225:f8fee6c586cc | 63 | /* sprintf((Time),"%d %d %d %d \r\n",Spi.DAC_B, Gyro.HighTreshold, Gyro.ResetLevelCool, Gyro.DownTreshold, Gyro.ResetLevelHeat); |
Kovalev_D | 225:f8fee6c586cc | 64 | WriteCon(Time);*/ |
Kovalev_D | 222:7de7b3bf3a1d | 65 | if(Gyro.RgConA&0x4) JumpTimer=0; |
Kovalev_D | 222:7de7b3bf3a1d | 66 | else |
Kovalev_D | 222:7de7b3bf3a1d | 67 | { |
Kovalev_D | 222:7de7b3bf3a1d | 68 | /*sprintf((Time),"%d %d\r\n",Gyro.RgConA,JumpTimer); |
Kovalev_D | 222:7de7b3bf3a1d | 69 | WriteCon(Time);*/ |
Kovalev_D | 222:7de7b3bf3a1d | 70 | JumpTimer++; |
Kovalev_D | 222:7de7b3bf3a1d | 71 | if(JumpTimer>(Gyro.TimeToJump-1)) |
Kovalev_D | 222:7de7b3bf3a1d | 72 | { |
Kovalev_D | 225:f8fee6c586cc | 73 | Gyro.PLCDelay = GyroP.Str.PLCDelay; |
Kovalev_D | 222:7de7b3bf3a1d | 74 | JumpMod(); |
Kovalev_D | 222:7de7b3bf3a1d | 75 | JumpTimer=0; |
Kovalev_D | 222:7de7b3bf3a1d | 76 | } |
Kovalev_D | 222:7de7b3bf3a1d | 77 | } |
Kovalev_D | 222:7de7b3bf3a1d | 78 | |
Kovalev_D | 222:7de7b3bf3a1d | 79 | |
Kovalev_D | 222:7de7b3bf3a1d | 80 | /*if(Gyro.ShowMod2) |
Kovalev_D | 220:04c54405b82d | 81 | { |
Kovalev_D | 220:04c54405b82d | 82 | sprintf((Time),"%d %d %d\r\n",Spi.DAC_B,AMPSUM_DESP,Spi.DAC_A); |
Kovalev_D | 220:04c54405b82d | 83 | WriteCon(Time); |
Kovalev_D | 220:04c54405b82d | 84 | Spi.DAC_B+=200; |
Kovalev_D | 222:7de7b3bf3a1d | 85 | }*/ |
Kovalev_D | 222:7de7b3bf3a1d | 86 | |
Kovalev_D | 208:19150d2b528f | 87 | Discharg(); |
Kovalev_D | 208:19150d2b528f | 88 | BackLight(); |
Kovalev_D | 208:19150d2b528f | 89 | Gyro.Rate1_Event = 1; |
Kovalev_D | 208:19150d2b528f | 90 | Event1Hz--; |
Kovalev_D | 208:19150d2b528f | 91 | Time1Hz++; |
Kovalev_D | 214:4c70e452c491 | 92 | // sprintf((Time),"%d \r\n",Gyro.ModeOut ); |
Kovalev_D | 214:4c70e452c491 | 93 | // WriteCon(Time); |
Kovalev_D | 222:7de7b3bf3a1d | 94 | } |
Kovalev_D | 88:b5c1d9d338d1 | 95 | } |
Kovalev_D | 222:7de7b3bf3a1d | 96 | |
Kovalev_D | 89:a0d344db227e | 97 | ///////////////////////////////////////////////////// |
Kovalev_D | 89:a0d344db227e | 98 | ///////////////////// 1kHz ////////////////////////// |
Kovalev_D | 197:7a05523bf588 | 99 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 100 | void Event_1KHz(void)// событие раз в 1 кГц |
Kovalev_D | 214:4c70e452c491 | 101 | { if (Event1K) |
Kovalev_D | 116:66f1f0ff2dab | 102 | { |
Kovalev_D | 214:4c70e452c491 | 103 | if(Gyro.PLCDelay) Gyro.PLCDelay--; |
Kovalev_D | 88:b5c1d9d338d1 | 104 | Event1K --; |
Kovalev_D | 215:b58b887fd367 | 105 | |
Kovalev_D | 116:66f1f0ff2dab | 106 | Time1K++;//первый ++ работает каждые 125 (event100kHz)второй был в 100 кГц |
Kovalev_D | 209:224e7331a061 | 107 | if (Time1K > 1000) |
Kovalev_D | 115:e5a230e5af52 | 108 | { |
Kovalev_D | 208:19150d2b528f | 109 | Time1K -=1000; |
Kovalev_D | 88:b5c1d9d338d1 | 110 | Event1Hz ++; |
Kovalev_D | 88:b5c1d9d338d1 | 111 | } |
Kovalev_D | 209:224e7331a061 | 112 | |
Kovalev_D | 214:4c70e452c491 | 113 | } |
Kovalev_D | 88:b5c1d9d338d1 | 114 | } |
Kovalev_D | 209:224e7331a061 | 115 | |
Kovalev_D | 222:7de7b3bf3a1d | 116 | void Event_5KHz(void)// событие раз в 5 кГц |
Kovalev_D | 218:b4067cac75c0 | 117 | { |
Kovalev_D | 218:b4067cac75c0 | 118 | int temp=0; |
Kovalev_D | 222:7de7b3bf3a1d | 119 | if (Event5K) |
Kovalev_D | 222:7de7b3bf3a1d | 120 | { |
Kovalev_D | 222:7de7b3bf3a1d | 121 | Gyro.EvenRate5K++; |
Kovalev_D | 222:7de7b3bf3a1d | 122 | Event5K --; |
Kovalev_D | 209:224e7331a061 | 123 | } |
Kovalev_D | 209:224e7331a061 | 124 | } |
Kovalev_D | 124:9ae09249f842 | 125 | void Event_500Hz(void)// событие раз в 500 Гц |
Kovalev_D | 124:9ae09249f842 | 126 | { |
Kovalev_D | 124:9ae09249f842 | 127 | if(Event500Hz) |
Kovalev_D | 225:f8fee6c586cc | 128 | { |
Kovalev_D | 225:f8fee6c586cc | 129 | if(Gyro.Debag2) |
Kovalev_D | 225:f8fee6c586cc | 130 | { |
Kovalev_D | 225:f8fee6c586cc | 131 | sprintf((Time),"%d %d \r\n", 0xffff-Spi.DAC_A, ((Spi.DAC_B-0x7fff)&0xffff)); |
Kovalev_D | 225:f8fee6c586cc | 132 | WriteCon(Time); |
Kovalev_D | 225:f8fee6c586cc | 133 | } |
Kovalev_D | 205:775d54fdf646 | 134 | Event500Hz--; |
Kovalev_D | 208:19150d2b528f | 135 | Gyro.Event_500Hz=1;// Event 500Гц выдачи данных для постройки графика управления вибро |
Kovalev_D | 197:7a05523bf588 | 136 | } |
Kovalev_D | 197:7a05523bf588 | 137 | } |
Kovalev_D | 209:224e7331a061 | 138 | void Event_250Hz(void) |
Kovalev_D | 209:224e7331a061 | 139 | { |
Kovalev_D | 209:224e7331a061 | 140 | if(Event250Hz) |
Kovalev_D | 209:224e7331a061 | 141 | { |
Kovalev_D | 218:b4067cac75c0 | 142 | |
Kovalev_D | 209:224e7331a061 | 143 | // Gyro.CuruAngle=0; |
Kovalev_D | 209:224e7331a061 | 144 | Event250Hz--; |
Kovalev_D | 209:224e7331a061 | 145 | MODCount++; |
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 | 220:04c54405b82d | 188 | |
Kovalev_D | 112:4a96133a1311 | 189 | LPC_TIM1->MR0 = TimerInterval; |
Kovalev_D | 112:4a96133a1311 | 190 | LPC_TIM1->MCR = 3; /* Interrupt and Reset on MR1 */ |
Kovalev_D | 112:4a96133a1311 | 191 | NVIC_EnableIRQ(TIMER1_IRQn); |
Kovalev_D | 112:4a96133a1311 | 192 | } |
Kovalev_D | 112:4a96133a1311 | 193 | |
Kovalev_D | 112:4a96133a1311 | 194 | |
igor_v | 0:8ad47e2b6f00 | 195 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 196 | /////////////////////////включение таймера 1////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 197 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 198 | void enable_timer1( void ) |
igor_v | 21:bc8c1cec3da6 | 199 | { |
igor_v | 21:bc8c1cec3da6 | 200 | LPC_TIM1->TCR = 1; |
igor_v | 21:bc8c1cec3da6 | 201 | return; |
igor_v | 21:bc8c1cec3da6 | 202 | } |
igor_v | 0:8ad47e2b6f00 | 203 | |
igor_v | 0:8ad47e2b6f00 | 204 | |
igor_v | 0:8ad47e2b6f00 | 205 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 206 | /////////////////////////////////////////////////TIMER2////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 207 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 208 | |
igor_v | 0:8ad47e2b6f00 | 209 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 210 | /////////////////////инициализация таймера 2 ///////////////////////// |
igor_v | 0:8ad47e2b6f00 | 211 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 212 | unsigned int Init_TIM2 (void) |
igor_v | 21:bc8c1cec3da6 | 213 | { |
Kovalev_D | 124:9ae09249f842 | 214 | LPC_TIM2->MR0 = 257; |
igor_v | 21:bc8c1cec3da6 | 215 | LPC_TIM2->MCR = 3; /* Interrupt and Reset on MR0 */ |
igor_v | 21:bc8c1cec3da6 | 216 | NVIC_EnableIRQ(TIMER2_IRQn); |
igor_v | 21:bc8c1cec3da6 | 217 | return 1; |
igor_v | 21:bc8c1cec3da6 | 218 | } |
igor_v | 0:8ad47e2b6f00 | 219 | |
igor_v | 21:bc8c1cec3da6 | 220 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 221 | /////////////////////////включение таймера 2////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 222 | ////////////////////////////////////////////////////////////////////// |
igor_v | 21:bc8c1cec3da6 | 223 | void enable_timer2(void) |
igor_v | 21:bc8c1cec3da6 | 224 | { |
igor_v | 21:bc8c1cec3da6 | 225 | LPC_TIM2->TCR = 1; |
igor_v | 21:bc8c1cec3da6 | 226 | LPC_TIM2->TCR = 0x01; |
igor_v | 21:bc8c1cec3da6 | 227 | } |
igor_v | 21:bc8c1cec3da6 | 228 | |
igor_v | 21:bc8c1cec3da6 | 229 | |
Kovalev_D | 112:4a96133a1311 | 230 | ////////////////////////////////////////////////////////////////////// |
Kovalev_D | 112:4a96133a1311 | 231 | /////////////////////////прерывание таймера 1////////////////////////// |
Kovalev_D | 112:4a96133a1311 | 232 | ////////////////////////////////////////////////////////////////////// |
Kovalev_D | 215:b58b887fd367 | 233 | __irq void TIMER1_IRQHandler (void)//13.27 kHz(vibro*32) |
Kovalev_D | 205:775d54fdf646 | 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 | 222:7de7b3bf3a1d | 279 | Time5K++; |
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 | 225:f8fee6c586cc | 295 | if (Time5K > 200000) |
Kovalev_D | 222:7de7b3bf3a1d | 296 | { Time5K = 0; |
Kovalev_D | 225:f8fee6c586cc | 297 | if(Gyro.Debag) |
Kovalev_D | 225:f8fee6c586cc | 298 | { |
Kovalev_D | 225:f8fee6c586cc | 299 | for(int q=0; q<64; q++) |
Kovalev_D | 225:f8fee6c586cc | 300 | { |
Kovalev_D | 225:f8fee6c586cc | 301 | sprintf((Time),"%i \r\n", ModArraySin [q]); |
Kovalev_D | 225:f8fee6c586cc | 302 | WriteCon(Time); |
Kovalev_D | 225:f8fee6c586cc | 303 | } |
Kovalev_D | 225:f8fee6c586cc | 304 | } |
Kovalev_D | 222:7de7b3bf3a1d | 305 | Event5K ++; |
Kovalev_D | 209:224e7331a061 | 306 | } |
Kovalev_D | 209:224e7331a061 | 307 | |
Kovalev_D | 197:7a05523bf588 | 308 | if (Time500Hz > 200) |
Kovalev_D | 208:19150d2b528f | 309 | { // LoopOn |
Kovalev_D | 197:7a05523bf588 | 310 | Time500Hz -= 200; |
Kovalev_D | 208:19150d2b528f | 311 | Event500Hz ++; |
Kovalev_D | 197:7a05523bf588 | 312 | } |
Kovalev_D | 209:224e7331a061 | 313 | |
Kovalev_D | 209:224e7331a061 | 314 | if (Time250Hz > 6) |
Kovalev_D | 209:224e7331a061 | 315 | { // LoopOn |
Kovalev_D | 209:224e7331a061 | 316 | Time250Hz -= 6; |
Kovalev_D | 209:224e7331a061 | 317 | Event250Hz ++; |
Kovalev_D | 209:224e7331a061 | 318 | } |
Kovalev_D | 210:b02fa166315d | 319 | |
Kovalev_D | 213:9953db9543d6 | 320 | //LoopOff |
igor_v | 21:bc8c1cec3da6 | 321 | } |