void main(void) { /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ nLoop = 0; SCIcount=0; AD1_Start(); Puls1_Enable(); Puls2_Enable(); TI1_DisableEvent(); Cpu_Delay100US(10000); if(!AD_Flag) { calibrateSensor(); TI1_EnableEvent(); AD_Flag = 1; } //---------------------------------------------------------------- for(;;) { nLoop ++; if(nLoop >= LOOP_TIME) nLoop = 0; else continue; //---------------------------------------------------------------- if((g_fGyroscopeAngleIntegral < 50.0) && (g_fGyroscopeAngleIntegral > -50.0)) //ж╠а╒еп╤о standFlag = 1; else if((g_fGyroscopeAngleIntegral >= 50.0) || (g_fGyroscopeAngleIntegral <= -50.0)) standFlag = 0; //---------------------------------------------------------------- Cpu_Delay100US(100); if(UartFlag == 1) { sendData(); UartFlag = 0; } receiveData(); } }
void FLOPPY_Init(void) { int i; for(i=0;i<FLOPPY_NOF_DRIVES;i++) { FLOPPY_Drives[i].forward = FALSE; FLOPPY_Drives[i].pos = 0; FLOPPY_Drives[i].currentPeriod = 0; FLOPPY_Drives[i].currentTick = 0; } FLOPPY_Drives[0].Dir = Drv0_Dir; FLOPPY_Drives[0].StepSetVal = Drv0_StepSetVal; FLOPPY_Drives[0].StepClearVal = Drv0_StepClrVal; FLOPPY_Drives[1].Dir = Drv1_Dir; FLOPPY_Drives[1].StepSetVal = Drv1_StepSetVal; FLOPPY_Drives[1].StepClearVal = Drv1_StepClrVal; FLOPPY_Drives[2].Dir = Drv2_Dir; FLOPPY_Drives[2].StepSetVal = Drv2_StepSetVal; FLOPPY_Drives[2].StepClearVal = Drv2_StepClrVal; FLOPPY_Drives[3].Dir = Drv3_Dir; FLOPPY_Drives[3].StepSetVal = Drv3_StepSetVal; FLOPPY_Drives[3].StepClearVal = Drv3_StepClrVal; FLOPPY_Drives[4].Dir = Drv4_Dir; FLOPPY_Drives[4].StepSetVal = Drv4_StepSetVal; FLOPPY_Drives[4].StepClearVal = Drv4_StepClrVal; FLOPPY_Drives[5].Dir = Drv5_Dir; FLOPPY_Drives[5].StepSetVal = Drv5_StepSetVal; FLOPPY_Drives[5].StepClearVal = Drv5_StepClrVal; FLOPPY_Drives[6].Dir = Drv6_Dir; FLOPPY_Drives[6].StepSetVal = Drv6_StepSetVal; FLOPPY_Drives[6].StepClearVal = Drv6_StepClrVal; FLOPPY_Drives[7].Dir = Drv7_Dir; FLOPPY_Drives[7].StepSetVal = Drv7_StepSetVal; FLOPPY_Drives[7].StepClearVal = Drv7_StepClrVal; TI1_Enable(); TI1_EnableEvent(); }