Esempio n. 1
0
/*
** ===================================================================
**     Event       :  Task3_task (module mqx_tasks)
**
**     Component   :  Task3 [MQXLite_task]
**     Description :
**         MQX task routine. The routine is generated into mqx_tasks.c
**         file.
**     Parameters  :
**         NAME            - DESCRIPTION
**         task_init_data  - 
**     Returns     : Nothing
** ===================================================================
*/
void Task3_task(uint32_t task_init_data)
{
	for(;;){
	volatile int16 xr,yr,zr;
	uint16 br;
	static char * st1 ="\n\rAccelerometer x value: "  ;
	static char * st2 ="\n\rAccelerometer y value: " ;
	static char * st3 ="\n\rAccelerometer z value: " ;
	static char * st4 ="\n\rLight Sensor value: " ;
	_lwsem_wait(&i2csem);
	xr=xw, yr=yw, zr=zw, br=bw;
	_lwsem_post(&i2csem);
	Term1_Cls();
	Term1_MoveTo(1,1);
	Term1_SendStr(st1);
	Term1_SendNum(xr);
	Term1_SendStr(st2);
	Term1_SendNum(yr);
	Term1_SendStr(st3);
	Term1_SendNum(zr);
	Term1_SendStr(st4);
	Term1_SendNum(br);
	Term1_SendStr(" ");

	_time_delay_ticks(50);
	}
//Term1_SendStr("\r \n");
	
}
Esempio n. 2
0
/*
** ===================================================================
**     Method      :  Term1_MoveTo (component Term)
**     Description :
**         Move cursor to position x, y. Range of coordinates can be
**         from 1 to the size, which depends on the used terminal.
**         Position [1,1] represents the upper left corner.
**     Parameters  :
**         NAME            - DESCRIPTION
**         x               - Column number
**         y               - Row number
**     Returns     : Nothing
** ===================================================================
*/
void Term1_MoveTo(uint8_t x,uint8_t y)
{
  SendESCPrefix();                     /* Send the escape prefix */
  Term1_SendNum((int32_t) y);          /* Send number of line */
  while (Inhr1_SendChar(0x3BU) == ERR_TXFULL){} /* Send the part of the escape sequence (';') */
  Term1_SendNum((int32_t) x);          /* Send number of column */
  while (Inhr1_SendChar(0x48U) == ERR_TXFULL){} /* Send the part of the escape sequence ('H') */
}
Esempio n. 3
0
/*lint -save  -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
  /* Write your local variable definition here */

	bool button=1;

	struct sensor s[6];
	
	int64_t min_avg[6]={23, 14, 15, 15, 18, 23};
	int64_t max_avg[6]={1000, 193, 172, 170, 160, 550};
	int i;
	int64_t error;

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  PE_low_level_init();
  /*** End of Processor Expert internal initialization.                    ***/

  /* Write your code here */
  //Initializeaza timer-ul
  CountTimer_Init((LDD_TUserData *)NULL);
  //Opreste motoarele
  motor(0, 0);
  //Activeaza PWM-ul pentru motoare
  PWM_stanga_Enable();
  PWM_dreapta_Enable();
  
  IR_LED_PutVal(0);
  while(button)
	button=Button_GetVal();
  WAIT1_Waitms(500);
  IR_LED_PutVal(1);

  while(1){
	  
	  readSensors(min_avg, max_avg, s);
	  WAIT1_Waitms(1);
#if DEBUG==TRUE
	  for(i=0; i<6; i++){
		  Term1_SendNum(s[i].value);
		  Term1_SendStr("  ");
	  }
	  for(i=0; i<6; i++){
		  Term1_SendNum(s[i].seen);
		  Term1_SendStr("  ");
	  }
#endif
	  error=propder(s);
#if DEBUG==TRUE
	  Term1_SendNum(error);
	  Term1_SendChar('\n');
	  Term1_SendChar('\r');
#endif
	  drive(error);

  }




  /*** Don't write any code pass this line, or it will be deleted during code generation. ***/
  /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
  #ifdef PEX_RTOS_START
    PEX_RTOS_START();                  /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
  #endif
  /*** End of RTOS startup code.  ***/
  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
  for(;;){}
  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/