![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
forkd
Fork of LGstaandart by
Diff: MTimer.c
- Revision:
- 215:b58b887fd367
- Parent:
- 214:4c70e452c491
- Child:
- 216:189b0ea1dc38
diff -r 4c70e452c491 -r b58b887fd367 MTimer.c --- a/MTimer.c Wed Aug 16 09:00:25 2017 +0000 +++ b/MTimer.c Tue Aug 29 06:33:08 2017 +0000 @@ -10,6 +10,7 @@ unsigned int CountV64=0; unsigned int CountV31=0; unsigned int CountV255=0; +unsigned int CountV511=0; unsigned int f,MODCount=0; int loop=0; int t; @@ -24,12 +25,9 @@ if(Event1250Hz) { Gyro.EvenRate7=1; - LoopOn - LoopOn - LoopOn - LoopOn + Event1250Hz--; - LoopOff + } } ///////////////////////////////////////////////////// @@ -39,9 +37,30 @@ { static int tempdac=0,tempdac1; if (Event1Hz) { + + + /* for(int q=0; q<64; q++) + { + if( Buff_Restored_Mod[(q-Gyro.PLC_Phase)& 0x3f ] > 0) sprintf((Time)," 1 "); + else sprintf((Time)," 0 "); + WriteCon(Time); + } + sprintf((Time)," \r\n "); + WriteCon(Time); + */ + + + /* Check(BuffTemp, 8); WriteConN (BuffTemp,8);*/ - + /* sprintf((Time)," %d \r\n", Gyro.PLC_regul); + WriteCon(Time);*/ + /* if(Gyro.RgConA&0x8) + { + if(Gyro.PLC_regul>0){Spi.DAC_B-=Gyro.PLC_regul*Gyro.PLC_Gain;} + else {Spi.DAC_B+=Gyro.PLC_regul*Gyro.PLC_Gain;} + } + Gyro.PLC_regul=0;*/ /* sprintf((Time)," %d %d \r\n", Spi.DAC_A,Gyro.DacIn); WriteCon(Time);*/ if(Gyro.LogMod==1) ShowMod2(); @@ -63,7 +82,7 @@ { if(Gyro.PLCDelay) Gyro.PLCDelay--; Event1K --; - + Time1K++;//первый ++ работает каждые 125 (event100kHz)второй был в 100 кГц if (Time1K > 1000) { @@ -78,23 +97,23 @@ {int temp=0; if (Event2K) - { if(Gyro.LogMod==2) - { temp=((((Spi.DAC_A/0.6667) - 30000))-0x7fff); - sprintf((Time),"%i %d %i %f %i %d \r\n", (Spi.DAC_B - 0x7fff), Gyro.LG_Type, Spi.DAC_A ,(Spi.DAC_A/0.6667),temp, Gyro.PLC_Eror_count ); - WriteCon(Time); - Gyro.PLC_Eror_count=0; - Gyro.LG_Type=1; - + { + if(Gyro.LogMod) + { + /* sprintf((Time)," %d %d %d %d \r\n", TSinMns, TSinPls, TSinMns - TSinPls, Gyro.PLC_Eror_count); + WriteCon(Time);*/ } Event2K --; - Gyro.Rate3_Event++; + //Gyro.Rate3_Event++; } } void Event_500Hz(void)// событие раз в 500 Гц { if(Event500Hz) { - + /* if(Gyro.LogMod==5) + { + } */ Event500Hz--; Gyro.Event_500Hz=1;// Event 500Гц выдачи данных для постройки графика управления вибро } @@ -116,6 +135,7 @@ Gyro.CaunPlusRate = 0; */ } + if(MODFlag==2) { /* BuffADC_64Point[MODCount&0x3f]=ADC5New;*/ @@ -209,7 +229,7 @@ ////////////////////////////////////////////////////////////////////// /////////////////////////прерывание таймера 1////////////////////////// ////////////////////////////////////////////////////////////////////// -__irq void TIMER1_IRQHandler (void)//13.27 kHz +__irq void TIMER1_IRQHandler (void)//13.27 kHz(vibro*32) { @@ -217,7 +237,9 @@ SetDAC(DAC); Global_Time++; CountV255++; // инкремент счеттчика + CountV511++; CountV255 &= 0xff; // ОБРЕЗАНИЕ СЧЕТЧИКА + CountV511 &= 0x1ff; CountV64 = CountV255 & 0x3f; CountV31 = CountV255 & 0x1f; // малый счетчик @@ -270,7 +292,7 @@ // LoopOn } - if (Time2K== 2000) + if (Time2K== 20000) { Time2K=0; //Time100K = 0; Event2K ++;