forkd

Dependencies:   mbed

Fork of LG2 by Dmitry Kovalev

Revision:
220:04c54405b82d
Parent:
218:b4067cac75c0
Child:
222:7de7b3bf3a1d
--- a/MTimer.c	Wed Sep 27 13:09:24 2017 +0000
+++ b/MTimer.c	Fri Oct 20 13:16:32 2017 +0000
@@ -36,48 +36,14 @@
 void Event_1Hz(void)// событие раз в 1 Гц
 { static int tempdac=0,tempdac1;
     if (Event1Hz)	
-    {
-
-       /* SinMns=0;    
-        SinPls=0; */ 		 
-     //BuffADC_64Point[CountV64] = ADC_64Point;
-    // BuffADC_32PointD[CountV64] =  ADC_32PointD;
-     /* for(int q=0; q<64; q++)
-            		{
-                    sprintf((Time)," %d ", Buff_Restored_Mod[q]);  
-               		WriteCon(Time);         		 	
-                	}
-                	sprintf((Time)," \r\n ");
-                	WriteCon(Time);
-                	 for(int q=0; q<64; q++)
-            		{
-            	    sprintf((Time)," %d ", BuffADC_64Point[q]);  
-               		WriteCon(Time);         		 	
-                	}
-                	sprintf((Time)," \r\n ");
-                	WriteCon(Time); */
-                  /* for(int q=0; q<64; q++)
-            		{
-            	    sprintf((Time)," %d  ", BuffADC_32PointD[q]);  
-               		WriteCon(Time);         		 	
-                	}
-                	sprintf((Time),"\r\n ");
-	 				WriteCon(Time);  
-    				*/
-    
-  /*  Check(BuffTemp, 8);
-    WriteConN (BuffTemp,8);*/
-    		/*     sprintf((Time),"   %d \r\n",  Spi.DAC_A);
-                 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();
+    {       /*sprintf((Time),"%d %d  %d\r\n",Spi.DAC_B,AMPSUM_DESP,Spi.DAC_A);
+            WriteCon(Time);*/
+    	if(Gyro.ShowMod2)
+    	{
+    		sprintf((Time),"%d %d  %d\r\n",Spi.DAC_B,AMPSUM_DESP,Spi.DAC_A);
+            WriteCon(Time);
+    		Spi.DAC_B+=200;
+    	}
       Discharg();
       BackLight();
       Gyro.Rate1_Event = 1; 
@@ -113,24 +79,13 @@
 
     if (Event2K) 
     {  
-
-      if(Gyro.LogMod)   
-          {  
-    	       sprintf((Time)," %d   %d  		 %d   %d  \r\n",   Spi.DAC_B,  Gyro.Debag,      Spi.DAC_A, Gyro.Debag2);
-               WriteCon(Time);
-    	  }
         Event2K --;
-
-        //Gyro.Rate3_Event++;  
     }
 }
 void Event_500Hz(void)// событие раз в 500 Гц
 {
 	if(Event500Hz)
 	{     
-	   /*        if(Gyro.LogMod==5) 
-   		  { 
-           } 	  */
 	 Event500Hz--;
 	 Gyro.Event_500Hz=1;// Event 500Гц  выдачи данных для постройки графика управления вибро
 	}
@@ -143,23 +98,6 @@
     // 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();
-	 	}
 	  }
 }
 /////////////////////////////////////////////////////
@@ -202,6 +140,7 @@
 unsigned int Init_TIM1 (unsigned int TimerInterval )
 {
    // LPC_SC->PCLKSEL0 |= (1<<4);
+   
     LPC_TIM1->MR0 = TimerInterval;
     LPC_TIM1->MCR = 3;				/* Interrupt and Reset on MR1 */
     NVIC_EnableIRQ(TIMER1_IRQn);
@@ -249,7 +188,6 @@
 __irq void TIMER1_IRQHandler (void)//13.27 kHz(vibro*32)
 {   
 
-    
     ResetCS(ADC);					  	 	//prepare ADC for sampling
     SetDAC(DAC);
     Global_Time++;