![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
forkd
Fork of LGstaandart by
Diff: MTimer.c
- Revision:
- 209:224e7331a061
- Parent:
- 208:19150d2b528f
- Child:
- 210:b02fa166315d
--- a/MTimer.c Tue Feb 07 10:11:35 2017 +0000 +++ b/MTimer.c Thu Apr 13 14:14:45 2017 +0000 @@ -10,7 +10,7 @@ unsigned int CountV64=0; unsigned int CountV31=0; unsigned int CountV255=0; -unsigned int f; +unsigned int f,MODCount=0; int loop=0; int t; ///////////////////////////////////////////////////// @@ -23,15 +23,29 @@ { if (Event1Hz) { - /*if(i) {LoopOn i=0;} - else {LoopOff i=1;}*/ + if(Gyro.LogMod) ShowMod2(); Discharg(); BackLight(); Gyro.Rate1_Event = 1; Event1Hz--; Time1Hz++; + + /* for(int i=0; i<32;i++) + { + sprintf((Time),"%d ", Buff_Restored_sin[i]); + WriteCon(Time); + } + sprintf((Time),"\r\n"); + WriteCon(Time); + for(int i=0; i<32;i++) + { + sprintf((Time)," %d ", Buff_1Point[i-7]); + WriteCon(Time); + } + sprintf((Time),"\r\n"); + WriteCon(Time);*/ + } - } } ///////////////////////////////////////////////////// ///////////////////// 1kHz ////////////////////////// @@ -40,24 +54,61 @@ { if (Event1K) { - + Event1K --; Time1K++;//первый ++ работает каждые 125 (event100kHz)второй был в 100 кГц - if (Time1K == 1000) + if (Time1K > 1000) { Time1K -=1000; Event1Hz ++; } + } } + +void Event_2KHz(void)// событие раз в 1 кГц +{ + if (Event2K) + { + Event2K --; + Gyro.Rate3_Event++; + } +} void Event_500Hz(void)// событие раз в 500 Гц { if(Event500Hz) - { + { + Event500Hz--; Gyro.Event_500Hz=1;// Event 500Гц выдачи данных для постройки графика управления вибро } } +void Event_250Hz(void) +{ + if(Event250Hz) + { + + // Gyro.CuruAngle=0; + Event250Hz--; + MODCount++; + if((MODCount&0x3f)==0) + {/* + sprintf((Time),"%d %d %d\r\n", Spi.DAC_B, (0xffff - Spi.ADC5), Gyro.CuruAngle); + WriteCon(Time); + Gyro.CuruAngle = 0; + Gyro.CaunMinRate = 0; + Gyro.CaunPlusRate = 0; + */ + } + if(MODFlag==2) + { + BuffADC_64Point[MODCount&0x3f]=ADC5New; + LPC_DAC->DACR = (ModArraySin[MODCount&0x3f] * Gyro.ModAmp); + + if((MODCount&0x3f)==0) PLCRegul250(); + } + } +} ///////////////////////////////////////////////////// ///////////////////// 100kHz ////////////////////////// ///////////////////////////////////////////////////// @@ -180,17 +231,33 @@ Gyro.VibroOutF=1; Event100K ++; Time500Hz++; + Time250Hz++; Time100K++; + Time2K++; + //Time2K++; // Time250Hz++; if (Time100K == 100) { Time100K = 0; Event1K ++; } + + if (Time2K== 50) + { Time2K=0; + //Time100K = 0; + Event2K ++; + } + if (Time500Hz > 200) { // LoopOn Time500Hz -= 200; Event500Hz ++; } + + if (Time250Hz > 6) + { // LoopOn + Time250Hz -= 6; + Event250Hz ++; + } } \ No newline at end of file