Ejemplo n.º 1
0
void RTOS_Start(void) {
#if PL_HAS_HW_SOUNDER
  BUZ_Disable();
#endif
#if PL_HAS_HW_TOUCHSCREEN
  TCHS1_Init();
#endif
#if PL_HAS_HW_LCD
  LCD1_Init();
#endif
#if PL_APP_MODE_I2C_LCD || PL_APP_MODE_I2C_TWR
  I2C_Init();
#endif
  AD_Init();
#if PL_HAS_ACCEL_DEMO
  ACCEL_StartOrientationTask();
#endif
#if PL_HAS_SHELL
  SERIAL_Start();
#endif
#if PL_USE_RTOS
  if (FRTOS1_xTaskCreate(TaskMain, "Main", configMINIMAL_STACK_SIZE+350, NULL, tskIDLE_PRIORITY+2, (xTaskHandle *) NULL)==pdPASS) {
    FRTOS1_vTaskStartScheduler(); /* Start the scheduler */
  }
#endif
}
Ejemplo n.º 2
0
char main(){
    int i;
    SERIAL_Init();
    INTEnableSystemMultiVectoredInt();
    Drive_Init();
    dbprintf("\nHello World");
    AD_Init(BAT_VOLTAGE);
    LED_Init(LED_BANK3);
    LED_OffBank(LED_BANK3, 0xf);
    wait();
    int pwm;

    while(1) {
        //Drive_Stop();
        wait();
        //Drive_Forward(MIN_SPEED);
        printf("\nFORWARD! speed=%u pwm=%u", motorSpeed[A], motorPWMValue[A]);
        //for (i = 0; i < 100; i++)
        //    wait();
        Drive_Stop();
        Drive_Pivot(left, 1);
        for (i = 0; i < 1; i++)
            wait();
        Drive_Stop();
        Drive_Pivot(right, 1);
        for (i = 0; i < 1; i++)
            wait();
        Drive_Stop();
        for (i = 0; i < 1; i++)
            wait();
    }
}
Ejemplo n.º 3
0
char Bot_Init(void)
{
    // Initialize modules
    AD_Init();
    PWM_Init();


    // Configure digital pins
    IO_PortsSetPortOutputs(MUX_PINS_PORT, MUX_PINS_OR);
    IO_PortsSetPortOutputs(MOTOR_PINS_PORT, MOTOR_PINS_LEFT_DIR |
			    MOTOR_PINS_RIGHT_DIR | MOTOR_PINS_LIFT_DIR | MOTOR_PINS_LIFT_EN);
    IO_PortsSetPortOutputs(SENSOR_PINS_PORT, SENSOR_PINS_LEDS);
    IO_PortsSetPortInputs(SENSOR_PINS_PORT, SENSOR_PINS_BUMP | SENSOR_PINS_TRACK);

	// Init lift motor to off
	IO_PortsClearPortBits(MOTOR_PINS_PORT, MOTOR_PINS_LIFT_EN);

    // Configure PWM pins
//    PWM_SetFrequency(PWM_BOT_FREQUENCY);
//    PWM_AddPins(MOTOR_PINS_LEFT_EN | MOTOR_PINS_RIGHT_EN);

    // Configure AD pins
    AD_AddPins(SENSOR_PINS_BEACON | SENSOR_PINS_TAPE);

    return SUCCESS;
}
Ejemplo n.º 4
0
Archivo: AD.c Proyecto: mgsit/Hand
int main(void) {
    unsigned int wait = 0;
    int readcount = 0;
    SERIAL_Init();
    INTEnableSystemMultiVectoredInt();
    mJTAGPortEnable(0);
    printf("\r\nUno A/D Test Harness\r\nThis will initialize all A/D pins and read them %d times", TIMES_TO_READ);
    printf("Value of pcfg before test: %X",AD1PCFG);


    AD_Init(AD_PORTV3 | AD_PORTV4 | AD_PORTV5 | AD_PORTV6 | AD_PORTV7 | AD_PORTV8 | AD_PORTW3 | AD_PORTW4 | AD_PORTW5 | AD_PORTW6 | AD_PORTW7 | AD_PORTW8 | BAT_VOLTAGE);
    char numtoread = 13;
    unsigned char cur = 0;
    while (readcount <= TIMES_TO_READ) {
        for (wait = 0; wait <= 100000; wait++)
            asm("nop");
//        printf("\r\nAN2\tAN3\tAN4\tAN5\tAN8\tAN9\tAN11\tAN10\tAN13\tAN12\tAN15\tAN14\tAN1\n");
        for (cur = 0; cur < numtoread; cur++) {
            printf("%d\t", ReadADPin(1 << cur));
        }
        printf("\r\n");
        readcount++;
    }
    printf("Done Reading Them\r\n");
    AD_End();
    printf("Value of pcfg after test: %X",AD1PCFG);
    return 0;
}
Ejemplo n.º 5
0
/****************************************************************************
 Function
     Roach_Init

 Parameters
    None.

 Returns
     SUCCESS if operation successful
     ERROR  otherwise

 Description
      Performs all the initialization necessary for the roach.
      this includes initializing the PWM module, the A/D converter, the
      data directions on some pins, and setting the initial motor directions.
 Notes
     None.

 Author
    Max Dunne, 2012.01.06
 ****************************************************************************/
char Roach_Init(void) {
    //Initialize the serial port
    SERIAL_Init();
    TIMERS_Init();
    //set the control pins for the motors
    PWM_Init(LEFT_PWM | RIGHT_PWM, 200);
    LEFT_DIR_TRIS = 0;
    LEFT_DIR_INV_TRIS = 0;
    RIGHT_DIR_TRIS = 0;
    RIGHT_DIR_INV_TRIS = 0;
    LEFT_DIR = 0;
    LEFT_DIR_INV = ~LEFT_DIR;
    RIGHT_DIR = 0;
    RIGHT_DIR_INV = ~RIGHT_DIR;

    //set up the hall effect and divorce all the A/D pins
    AD1PCFG = 0xFF;
    HALL_FRONT_LEFT_TRIS = 1;
    HALL_FRONT_RIGHT_TRIS = 1;
    HALL_REAR_RIGHT_TRIS = 1;
    HALL_REAR_LEFT_TRIS = 1;


    //Initialize the light sensor
    AD_Init(LIGHT_SENSOR);

    //enable interrupts
    INTEnableSystemMultiVectoredInt();
}
Ejemplo n.º 6
0
Archivo: AD.c Proyecto: mgsit/Hand
int main(void) {
    unsigned int wait = 0;
    int readcount = 0;
    SERIAL_Init();
    INTEnableSystemMultiVectoredInt();
    mJTAGPortEnable(0);
    printf("\r\nUno A/D Test Harness\r\nThis will initialize all A/D pins and read them %d times", TIMES_TO_READ);
    printf("Value of pcfg before test: %X",AD1PCFG);


    AD_Init(AD_PORTV3 | AD_PORTV4 | AD_PORTV5 | AD_PORTV6 | AD_PORTW4 | AD_PORTW3 | BAT_VOLTAGE | PINA);
    unsigned char cur = 0;
    while (readcount <= TIMES_TO_READ) {
        for (wait = 0; wait <= 100000; wait++)
            asm("nop");
        printf("\r\nAN0\tAN1\tAN2\tAN3\tAN4\tAN5\tAN11\tAN10\n");
        printf("%d\t", ReadADPin(PINA));
        printf("%d\t", ReadADPin(BAT_VOLTAGE));
        printf("%d\t", ReadADPin(AD_PORTV3));
        printf("%d\t", ReadADPin(AD_PORTV4));
        printf("%d\t", ReadADPin(AD_PORTV5));
        printf("%d\t", ReadADPin(AD_PORTV6));
        printf("%d\t", ReadADPin(AD_PORTW4));
        printf("%d\t", ReadADPin(AD_PORTW3));
        readcount++;
    }
    printf("Done Reading Them\r\n");
    AD_End();
    printf("Value of pcfg after test: %X",AD1PCFG);
    return 0;
}
Ejemplo n.º 7
0
int main(void) {

    SERIAL_Init();
    TIMERS_Init();
    char i, j = 0;
    int k, l = 0;
    int time = GetTime();
    INTEnableSystemMultiVectoredInt();
    AD_Init(IR_PINS);
    IR_Init();

    while (1) {
        k = ReadADPin(IR_LEFT);
        l = ReadADPin(IR_RIGHT);
		char leftTrig = '_';
		char rightTrig = '_';
		if (IR_LeftTriggered())
			leftTrig = 'x';
		if (IR_RightTriggered())
			rightTrig = 'x';
			
        //if (time > GetTime() + 500) {
            if (IsTransmitEmpty()) {
                printf("\n %cLeft : %d \n %cRight : %d",leftTrig, k, rightTrig, l);
            }
                wait();
            //time = GetTime();
        //}
        //while (!IsTransmitEmpty()); // bad, this is blocking code
    }
    return 0;
}
Ejemplo n.º 8
0
Archivo: main.c Proyecto: fantasea/APRS
static void init(void)
{
	/* Enable all the interrupts */
	IRQ_ENABLE;

	/* Initialize debugging module (allow kprintf(), etc.) */
	kdbg_init();
	/* Initialize system timer */
	timer_init();
	/* Initialize LED driver */
	LED_INIT();

	ser_init(&ser_port, SER_UART2);
	ser_setbaudrate(&ser_port, 115200L);

	afsk_init(&afsk, 0, 0);

	// timer period = 24000000 hz /100/25 = 9600hz
	AD_Init(&afsk);
	AD_SetTimer(100, 25);
	AD_Start();

	DA_Init(&afsk);
	DA_SetTimer(100, 25);

	kiss_init(&ser_port, &ax25, &afsk);

	ax25_init(&ax25, &afsk.fd, 1, ax25_message_callback);
}
void main()
   {
   AD_Init(); 
   PWM_Init_T2();

   while(1)
      {
      AD_Get_Sample();
      PWM_Update_T2(Analog_G);
      }     
   }   
Ejemplo n.º 10
0
void EMG_Init()
{
    AD_Init();
    AD_AddPins(AD_PORTW4); // AD1 for EMG signal
    EMG_DIGIPOT_CS_OUT;
    EMG_DIGIPOT_CS_SET_LOW;
    EMG_DIGIPOT_INC_OUT;
    EMG_DIGIPOT_UD_OUT;
    EMG_reset();
    return;
}
Ejemplo n.º 11
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
	RCC_ClocksTypeDef RCC_Clocks;


  /* SysTick end of count event each 10ms */
  RCC_GetClocksFreq(&RCC_Clocks);
  SysTick_Config(RCC_Clocks.HCLK_Frequency / 100);
	
	/********************输出 初始化 ******************/
	PWM_init();
  
	
	STM324xG_LCD_Init();	
  LCD_Clear(BLACK);/* Clear the LCD */
  LCD_SetBackColor(BLACK);/* Set the LCD Back Color */  
  LCD_SetTextColor(WHITE);/* Set the LCD Text Color */	
  LCD_DisplayStringLine(LINE(0), "  Hello jaja. I'm xiaohei01");
	
	
	/********************输入 初始化 ******************/
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_3);/*!< 3 bits for pre-emption priority 1 bits for subpriority */	
	
	Encoder_init();	//encoder tim8	
	usart_init();//通信COM usart2 115200
	
	IMU_init();	
	if (get_mode()==1)
	{
		IMU_BE10();
	}
	
	KEY_init();		
	AD_Init();	
	GPS_int();

	TIM2_Configuration();
	printf("uart init OK 2 \r\n");

	
while(1)
  {


	if(LCD_flag)
	{
		LCD_flag=0;
		lcd_refresh();
	}


  }  
}
Ejemplo n.º 12
0
void main(void) {
	EnableInterrupts;
  SetBusCLK_40M();    //   设置时钟初始化。40MHz.
  SCI_Init();
  AD_Init(); //     AD初始化。
  DDRM = 0X1F;        //启动LCD
	LCD_start();  //初始化LCD模块 
	LCD_clear(); //清屏幕 
	
	LCD_startshow();

  for(;;) {
//  TestSMinfo();
  }
}
Ejemplo n.º 13
0
void main(void) 
{ 
    char send_cnt=0;
    SetBusCLK_40M();
    SCI0_Init();     
    PIT_Init();
    AD_Init();
    CCD_IO_Init();
    PWM_Init();
    PAC_Init();
    DDRT_DDRT0=1;
    PTT_PTT0=1;
    delay();
    Motor_forward(26);
    steering(STEER_MID);
    DDRM=0XFF;
    EnableInterrupts;
    for(;;)
    {

        if(TimerFlag20ms == 1) 
        {
            DisableInterrupts;
            TimerFlag20ms = 0;
            ImageCapture(Pixel);
            //CalculateIntegrationTime();
            //mid_val_3(Pixel);
            //send_cnt++;
            /*if(send_cnt>10) 
            {
                send_cnt=0;
                SendImageData(Pixel);
            } */
            find(Pixel,5,3,20);
            //CCD_P2(Pixel,3,18);
           steer_pd();
           EnableInterrupts;    
        }
    }
             
}
Ejemplo n.º 14
0
int main(void)
{
    unsigned int wait = 0;
    int readcount = 0;
    unsigned int CurPin = 0;
    unsigned int PinListing = 0;
    char FunctionResponse = 0;
    char TestFailed = FALSE;
    //SERIAL_Init();
    //INTEnableSystemMultiVectoredInt();
    BOARD_Init();
    mJTAGPortEnable(0);
    printf("\r\nUno A/D Test Harness\r\nThis will initialize all A/D pins and read them %d times\r\n", TIMES_TO_READ);
    //printf("Value of pcfg before test: %X\r\n", AD1PCFG);
    // while(!IsTransmitEmpty());
    //AD_Init(BAT_VOLTAGE);
    //AD_Init();
    printf("Testing functionality before initialization\r\n");

    /*adding pins individually */
    printf("AD_AddPins on each pin indvidually which results in failure: ");
    for (CurPin = 1; CurPin < ALLADPINS; CurPin <<= 1) {
        FunctionResponse = AD_AddPins(CurPin);
        if (FunctionResponse != ERROR) {
            TestFailed = TRUE;
            break;
        }
    }
    if (TestFailed) {
        printf("FAIL\r\n");
    } else {
        printf("PASSED\r\n");
    }
    TestFailed = FALSE;
    /*removing pins individually*/
    printf("AD_RemovePins on each pin indvidually which results in failure: ");
    for (CurPin = 1; CurPin < ALLADPINS; CurPin <<= 1) {
        FunctionResponse = AD_RemovePins(CurPin);
        if (FunctionResponse != ERROR) {
            TestFailed = TRUE;
            break;
        }
    }
    if (TestFailed) {
        printf("FAIL\r\n");
    } else {
        printf("PASSED\r\n");
    }
    TestFailed = FALSE;
    /*listing pins while inactive*/
    printf("AD_ActivePins which should return 0: ");
    PinListing = AD_ActivePins();
    if (PinListing != 0x0) {
        printf("FAILED\r\n");

    } else {
        printf("PASSED\r\n");
    }
    //    /*calling ned when inactive*/
    //        printf("AD_End which should fail: ");
    //        FunctionResponse = AD_End();
    //        if (FunctionResponse != ERROR) {
    //            printf("FAILED\r\n");
    //        } else {
    //            printf("PASSED\r\n");
    //        }
    /*activating module*/
    printf("initializing using AD_Init: ");
    FunctionResponse = AD_Init();
    if (FunctionResponse != SUCCESS) {
        printf("FAILED\r\n");
    } else {
        printf("PASSED\r\n");
    }
    /*attempting to reactivate*/
    printf("initializing using AD_Init again returns error: ");
    FunctionResponse = AD_Init();
    if (FunctionResponse != ERROR) {
        printf("FAILED\r\n");
    } else {
        printf("PASSED\r\n");
    }
    printf("Testing Functionality after initialization\r\n");
    /*active pins after activation only has battery*/
    printf("Ad_ActivePins should only return BAT_VOLTAGE: ");
    PinListing = AD_ActivePins();
    if (PinListing == BAT_VOLTAGE) {
        printf("PASSED\r\n");
    } else {
        printf("FAILED\r\n");
    }
    /*each pin added should succeed*/
    printf("Adding each pin using AD_AddPins indivdually: ");
    for (CurPin = 1; CurPin < ALLADMINUSBATT; CurPin <<= 1) {
        PinListing = AD_ActivePins();
        FunctionResponse = AD_AddPins(CurPin);
        if (FunctionResponse != SUCCESS) {
            TestFailed = TRUE;
            break;
        }
        while (AD_ActivePins() != (PinListing | CurPin));
    }
    if (TestFailed) {
        printf("FAIL\r\n");
    } else {
        printf("PASSED\r\n");
    }
    /*removing each pin should succeed */
    printf("Removing each pin using AD_RemovePins indivdually: ");
    for (CurPin = 1; CurPin < ALLADMINUSBATT; CurPin <<= 1) {
        PinListing = AD_ActivePins();
        FunctionResponse = AD_AddPins(CurPin);
        if (FunctionResponse != SUCCESS) {
            TestFailed = TRUE;
            break;
        }
        while (AD_ActivePins() != (PinListing | CurPin));
    }
    if (TestFailed) {
        printf("FAIL: %X\r\n", 0xFEED);
    } else {
        printf("PASSED\r\n");
    }
    while (1);
    printf("We will now add the odd pins and wait for them to be activated");
    AD_AddPins(ODD_ACTIVE);
    while (!(AD_ActivePins() & ODD_ACTIVE)) {
        if (IsTransmitEmpty()) {
            printf("%X\r\n", AD_ActivePins());
        }
    }
    printf("The Odd pins are now active as shown by Active pins: %X\r\n", AD_ActivePins());
    printf("We will now enable the even pins and wait for them to be activated");
    AD_AddPins(EVEN_ACTIVE);
    while (!(AD_ActivePins() & EVEN_ACTIVE));
    printf("The Even pins are now active as shown by Active pins: %X\r\n", AD_ActivePins());


    char numtoread = NUM_AD_PINS;
    unsigned char cur = 0;
    DELAY(400000)
    while (readcount <= TIMES_TO_READ) {
        DELAY(100000);
        printf("\r\n");
        for (cur = 0; cur < numtoread; cur++) {
            printf("%d\t", AD_ReadADPin(1 << cur));
        }
        printf("\r\n");
        readcount++;
    }
    printf("Done Reading Them\r\n");
    AD_End();
    printf("Value of pcfg after test: %X", AD1PCFG);
    return 0;
}
//------------------------------------------------------------------------------
void main(void)
{
 
  WDTCTL = WDTPW+WDTHOLD;                   // Stop watchdog timer
  FCTL2 = FWKEY + FSSEL0 + FN0;             // MCLK/2 for Flash Timing Generator

  read_flash_segA();

  Rs232_Init();                             //  RS232 初始化      115200   P3  
  TDCM3_Init();                             //  電子羅盤 初始化
  
  P4DIR = 0xff;                             // Set P4. to output direction 
  P4OUT = 0;

  WDT_flag = true;
  TBCTL = TBSSEL_2 + MC_1;                  // SCLK, up-down mode  PWM timeClock
  
  AD_Init();
 
  WDTCTL = WDT_ARST_1000;                   //--開狗
  
  CloseMotorPower();                        //----開電測試系統  
  
     // TimerA 啟動讀秒
      TACCTL0 = CCIE;                             // CCR0 interrupt enabled
      TACCR0 = 16384-1;                           // for 0.5 Hz
      TACTL = TASSEL_1 + MC_1;                    // ACLK, contmode  

    //     _BIS_SR(GIE);    

     Setting_mode = true;
     long int cou_delay;     
     
     while(Setting_mode){                      //---- setting mode
     
               if(Set_OriginX_flag){
                Set_OriginX_flag = 0;
                OpenMotorPower();
                cou_delay = (long int)motor_T_AD * 1150; //       delay
                while(cou_delay > 0){ cou_delay--;}       
                DoTheAd(AD_AVGtime,1);  
                CloseMotorPower();
                Set_OriginX =  (int)(Angle_X*100);
                write_flash_segA();
              }
              if(Set_OriginY_flag){
                Set_OriginY_flag = 0;
                OpenMotorPower();
                cou_delay = (long int)motor_T_AD * 1150; //       delay
                while(cou_delay > 0){ cou_delay--;}       
                DoTheAd(AD_AVGtime,1);  
                CloseMotorPower();
                Set_OriginY =  (int)(Angle_Y*100);
                write_flash_segA();
              }

           _BIS_SR(LPM0_bits + GIE);    
     
     }
      
  IE2 &= ~URXIE1 ;                           // Disable USART1 RX interrupt
          ReStart_Sec +=  ((unsigned long int)ReStart_Day * 3600);  //--
 //         ReStart_Sec +=  ((unsigned long int)ReStart_Day * 60);  //--  每隔分鐘數
  PwmSet();
  
int testRun = 0;
   Leveling = true;
while(1)          //-------------- working mode
  {
                           
    if(Leveling){  
      
      
       WDTCTL = WDTPW+WDTHOLD;                       // Stop watchdog timer
       TACCTL0 &= ~CCIE;                             // close timer
       
       
       Leveling = false;
       outPutcount = false;
       
       //TDCM3_Enable();

         testRun++;
           sprintf(string,"this is %02d time   \r\n",testRun); UART1_SendStr(string);
        
      OpenMotorPower();       //----開電  
      WDTCTL = WDTPW+WDTHOLD;                       // Stop watchdog timer
      
                long int cou = (long int)motor_T_AD * 1150; //    100Hz   delay
                while(cou > 0){       cou--;   }       
                
      GoToRange_V2();
      GoHome();
     
      CloseMotorPower();      //----關電  
        outPutcount = true;
        
        TACCTL0 |= CCIE;                             // open timer
        
    }


    _BIS_SR(LPM0_bits + GIE);                 // Enter LPM0, Enable interrupts
 
    
    
      
  }
  
    
    
  
}
Ejemplo n.º 16
0
int main(void) {

    // ----------------- Initialization --------------
    SERIAL_Init();
    AD_Init(POT_INPUT);

    // Initialize interrupts
    INTEnableSystemMultiVectoredInt();

    RC_Init(RC_PORT);
    unsigned int wait = 0;
    for (wait = 0; wait <= 1000000; wait++)
        asm("nop");
    RC_SetPulseTime(RC_PORT, 2000);

    printf("\nHello,...");

    while (1) {
        
        // Read and print potentiometer
        unsigned int potValue = ReadPotentiometer();
        //printf("\nPot. reading: %x", potValue);

        // Pause if desired
        #ifdef ADC_PAUSE
        
        #endif

        unsigned int newSpeed = potValue +1000;
        printf("\nPot value to %u", potValue);

        // bound it
        newSpeed = max(newSpeed,MINPULSE);
        newSpeed = min(newSpeed,MAXPULSE);
        // effect the motor
        if (RC_SetPulseTime(RC_PORT, newSpeed) == SUCCESS) {
            printf("\nSuccessfully set PWM to %u", newSpeed);
        }
        else {
            printf("\nFailed to set PWM to %u", newSpeed);
        }
         
/*
        char keyPressed = GetChar();
        if (keyPressed != 0) {
            /*
            if (keyPressed == 'f') {
                // forward
                printf("\nforward");
                if (DIRECTION != FORWARD)
                    DIRECTION = FORWARD;
            }
            else if(keyPressed == 'r') {
                 // reverse
                printf("\nreverse");
                if (DIRECTION != REVERSE)
                    DIRECTION = REVERSE;
            }
            else if(keyPressed == 'q') {
                printf("\nGoodbye!");
                PWM_End();
                return 0;
            }
             
            if(keyPressed == 't') {
                unsigned short int stringMax = 4;
                unsigned short int i = 0;
                char charNumber[1];
                charNumber[0] = 0;
                char stringNumber[stringMax+1];
                printf("\nPlease enter a frequency:");

                while(charNumber[0] != 46) {
                        charNumber[0] = GetChar();
                        //printf("\nGot %s", charNumber);
                        if ((charNumber[0] <= 57 && charNumber[0] >= 48)) {
                            stringNumber[i] = charNumber[0];
                            stringNumber[i+1] = '\0';
                            //printf("\nAppended %c to '%s'",charNumber[0],stringNumber);
                            //stringNumber = strcat(stringNumber, charNumber);
                            i++;
                        }

                        if (i >= stringMax)
                            break;
                        
                }
                //printf("\ni=%u stmax=%u", i, stringMax);
                printf("\nDone");

                unsigned int newFreq = atoi(stringNumber);
                newFreq = max(newFreq,MINPULSE);
                newFreq = min(newFreq,MAXPULSE);
                printf("\nPulse width set to %u",newFreq);
                RC_SetPulseTime(RC_PORT,newFreq);
                
            }
        } // end of keyPressed
        */
 
        while (!IsTransmitEmpty()); // bad, this is blocking code
    } // end of while loop

    return 0;
}
Ejemplo n.º 17
0
void main(void) 
{

 // int temp_laserStatus;           //定义一个数组用来接受 上下舵机值
//  DisableInterrupts;
  SetBusCLK_40M();    //   设置时钟初始化。40MHz.
  //PITInit();          //PIT初始
 // PWM_Init();
 // LIGHT_Init();
  SCI_Init();
 // Tect_Speed_Init();    //ECT 捕捉初始
  AD_Init(); 
  delayms(3200);
 // Laser_num();
//  EnableInterrupts;
  for(;;) 
  {
   // Light_Up();         //激光整排点亮
     
    Collect_IR();   //这两个是红外捕捉和判断红外位置 先注释
    Cross_judge();          
    TestIR(IR_temp_laser_array);

    
  // Clear_baitou();  //position的第一次滤波
 //  baitou_delay++;
 //  if(baitou_delay%8==0) 
 //  {
 //   baitou_delay=1;
  //  baitou( ); //先执行摆头舵机,通过计算得出角度,为第二次滤波做准备
  //  }
     
    
   
  // General_Position();      
  // Collect_Point();
  // Collect_Section();
  // Judge_Slope();
 //  Clear_General();
 //  delay_count++;
   
   
   
   
 //  dajiao();
   
  /*send_count++;
  if(send_count%20==0) {
    send_count=1;
    TestSMinfo(1);  
   }*/   
  
  
//Clear_Speed();
//    SpeedCtrl();  
  
 }
    
 
   
  
  

          
// _FEED_COP(); /*看门狗,防死循环用的 */
 /* loop forever */
  /* please make sure that you never leave main */
}