void main(void)
   {
   // Set up the scheduler 
   SCH_Init_T2();

   // Set up the display
   BARGRAPH_Init();

   // Set up the switch pin
   SWITCH_MS_Init();

   // Add a 'SWITCH_MS_Update' task, every ~200 ms
   // - timings are in ticks (50 ms tick interval - see Sch 'init' function)
   SCH_Add_Task(SWITCH_MS_Update, 0, 4);

   // Add a 'COUNTER_Update' task every ~1000 ms
   SCH_Add_Task(COUNTER_Update, 0, 20);

   SCH_Start();

   while(1)
      {
      SCH_Dispatch_Tasks();
      }
   }
/* ............................................................... */
void main(void)
   {
   // Initialisation can be problematic with some display / supply
   // combinations.  You may get away with calling this function
   // twice (or once) but - for maximum reliability under a very wide range 
   // of conditions - it is called three times here.
   LCD_Init(0);
   LCD_Init(0);
   LCD_Init(1);

   // Prepare the elapsed time library
   Elapsed_Time_LCD_Init();

   // Prepare the scheduler
   SCH_Init_T2();

   // Add tasks to the scheduler
   //
   // Update the time every second (*** 1ms sched ticks ***)
   SCH_Add_Task(Elapsed_Time_LCD_Update, 100, 1000);

   // Update the whole display ~ every second 
   // - do this by updating a character once every 24 ms
   // (assumes a 40 character display)
   SCH_Add_Task(LCD_Update, 1000, 24);

   // All tasks added: start running the scheduler
   SCH_Start();   

   while(1)
      {
      SCH_Dispatch_Tasks();
      }
   }
Ejemplo n.º 3
0
void main(void)
{  
   // setup microcontroller
   PLLCON = 0x00;
   P0 = 0x00;
   P1 &= ~(1<<6);
   P1 &= ~(1<<7);

   // Set up the scheduler
   SCH_Init_T2();

   // init tasks
   init_statemachine();

   // - timings are in ticks (~1 ms tick interval)
   SCH_Add_Task(statemachine, 0, 10);
   SCH_Add_Task(switchStateMachine, 5, 20);

   // Start the scheduler
   SCH_Start();				

   while(1) {
      SCH_Dispatch_Tasks();
   }
}
Ejemplo n.º 4
0
void main(){
	SCH_Init_T2();

	led_init();

	SCH_Add_Task(draw1,0,2);
	SCH_Add_Task(draw2,1,2);
	SCH_Add_Task(draw,0,34);

	SCH_Start();
	while(1){
		SCH_Dispatch_Tasks();
		button();
		if(350==count++){
			count=0;
			move();
		}	
	}
}
void main(void)
   {
   // Set up the scheduler
   SCH_Init_T2();

   // Prepare for the 'Flash_LED' task
   LED_Flash_Init();

   // Add the 'Flash LED' task (on for ~1000 ms, off for ~1000 ms)
   // - timings are in ticks (6 ms tick interval)
   // (Max interval / delay is 65535 ticks)
   SCH_Add_Task(LED_Flash_Update, 0, 167);

   // Start the scheduler
   SCH_Start();

   while(1)
      {
      SCH_Dispatch_Tasks();
      }
   }
void main(void)
   {
   // Set up the scheduler
   SCH_Init_T2();

   // Set baud rate to 9600, using internal baud rate generator
   // Generic 8051 version
   PC_LINK_IO_Init_Internal(9600);

   // We have to schedule this task (10x a second is enough here)
   // - this checks if a character has been received by the USART
   // - if so, responds appropriately. 
   //
   // TIMING IS IN TICKS NOT MILLISECONDS (1 ms tick interval)
   SCH_Add_Task(MENU_Command_Processor,100,100);

   SCH_Start();

   while(1)
      {
      SCH_Dispatch_Tasks();
      }
   }
void main(void)
   {
   // Set up the scheduler
   SCH_Init_T2();

   // Add the 'Time Update' task (once per second)
   // - timings are in ticks (1 ms tick interval)
   // (Max interval / delay is 65535 ticks)
   SCH_Add_Task(CLOCK_LED_Time_Update,100,10);

   // Add the 'Display Update' task (once per second)
   // Need to update a 4-segment display every 3 ms (approx)
   // Need to update a 2-segment display every 6 ms (approx)
   SCH_Add_Task(LED_MX4_Display_Update,0,3);

   // Start the scheduler
   SCH_Start();

   while(1)
      {
      SCH_Dispatch_Tasks();
      }
   }